select t.knrd_type as knlx, a.* from srs_knrd_apply as a left join srs_knrd_type as t on t.stu_no = a.xh and t.stu_year_id = a.stu_year_id insert into srs_knrd_apply step, xm, xb, mz, sfzhm, xh, csny, knlx, knlx2, rkzs, srly, hjxz, hjszd, jtcy, jtjzfqk, jtqcqk, jtxjzdz, jzdh, jtnsr, rjnsr, jtzysr, jtzysr2, ssldnl, hbcjr, zyssldnl, tfsj, sqrqm, sqrqmrq, bjpyyj, pyxzzzqm, pyxzzzqmrq, fdyqm, fdyqmrq, ejxyldqmyj, ejxyldqm, ejxyldqmrq, xsqmyj, xsqm, xsqmrq, create_id, xsqmyjstate, ejxyldqmyjstate, bjpyyjstate, jtcyzxrs, syrs, jtcysyrs, affixId, parentstel, tfsj2, tfsj3, apply_year, xy, nj, bj, phone, jg, sqly, sqrcn, fdymc, fdygh, ejxyldgh, ejxyldmc, xsgh, xsmc, stu_year_id, #{step}, #{xm}, #{xb}, #{mz}, #{sfzhm}, #{xh}, #{csny}, #{knlx}, #{knlx2}, #{rkzs}, #{srly}, #{hjxz}, #{hjszd}, #{jtcy}, #{jtjzfqk}, #{jtqcqk}, #{jtxjzdz}, #{jzdh}, #{jtnsr}, #{rjnsr}, #{jtzysr}, #{jtzysr2}, #{ssldnl}, #{hbcjr}, #{zyssldnl}, #{tfsj}, #{sqrqm}, #{sqrqmrq}, #{bjpyyj}, #{pyxzzzqm}, #{pyxzzzqmrq}, #{fdyqm}, #{fdyqmrq}, #{ejxyldqmyj}, #{ejxyldqm}, #{ejxyldqmrq}, #{xsqmyj}, #{xsqm}, #{xsqmrq}, #{createId}, #{xsqmyjstate}, #{ejxyldqmyjstate}, #{bjpyyjstate}, #{jtcyzxrs}, #{syrs}, #{jtcysyrs}, #{affixId}, #{parentstel}, #{tfsj2}, #{tfsj3}, #{applyYear}, #{xy}, #{nj}, #{bj}, #{phone}, #{jg}, #{sqly}, #{sqrcn}, #{fdymc}, #{fdygh}, #{ejxyldgh}, #{ejxyldmc}, #{xsgh}, #{xsmc}, #{stuYearId}, update srs_knrd_apply step = #{step}, xm = #{xm}, xb = #{xb}, mz = #{mz}, sfzhm = #{sfzhm}, xh = #{xh}, csny = #{csny}, knlx = #{knlx}, knlx2 = #{knlx2}, rkzs = #{rkzs}, srly = #{srly}, hjxz = #{hjxz}, hjszd = #{hjszd}, jtcy = #{jtcy}, jtjzfqk = #{jtjzfqk}, jtqcqk = #{jtqcqk}, jtxjzdz = #{jtxjzdz}, jzdh = #{jzdh}, jtnsr = #{jtnsr}, rjnsr = #{rjnsr}, jtzysr = #{jtzysr}, jtzysr2 = #{jtzysr2}, ssldnl = #{ssldnl}, hbcjr = #{hbcjr}, zyssldnl = #{zyssldnl}, tfsj = #{tfsj}, sqrqm = #{sqrqm}, sqrqmrq = #{sqrqmrq}, bjpyyj = #{bjpyyj}, pyxzzzqm = #{pyxzzzqm}, pyxzzzqmrq = #{pyxzzzqmrq}, fdyqm = #{fdyqm}, fdyqmrq = #{fdyqmrq}, ejxyldqmyj = #{ejxyldqmyj}, ejxyldqm = #{ejxyldqm}, ejxyldqmrq = #{ejxyldqmrq}, xsqmyj = #{xsqmyj}, xsqm = #{xsqm}, xsqmrq = #{xsqmrq}, create_id = #{createId}, xsqmyjstate =#{xsqmyjstate}, ejxyldqmyjstate =#{ejxyldqmyjstate}, bjpyyjstate =#{bjpyyjstate}, jtcyzxrs=#{jtcyzxrs}, syrs=#{syrs}, jtcysyrs=#{jtcysyrs}, affixId=#{affixId}, parentstel=#{parentstel}, tfsj2=#{tfsj2}, tfsj3=#{tfsj3}, apply_year=#{applyYear}, xy=#{xy}, nj=#{nj}, bj=#{bj}, phone=#{phone}, jg=#{jg}, sqly=#{sqly}, sqrcn=#{sqrcn }, fdymc=#{fdymc}, fdygh=#{fdygh}, ejxyldgh=#{ejxyldgh}, ejxyldmc=#{ejxyldmc}, xsgh=#{xsgh}, xsmc=#{xsmc}, stu_year_id=#{stuYearId}, where id = #{id} delete from srs_knrd_apply where id = #{id} delete from srs_knrd_apply where id in #{id} update srs_knrd_apply a left join srs_knrd_apply b on a.id = b.id a.step = #{step}, a.bjpyyj = #{bjpyyj}, a.fdyqm = #{fdyqm}, a.fdyqmrq = #{fdyqmrq}, a.ejxyldqmyj = b.bjpyyj, a.ejxyldqm = #{ejxyldqm}, a.ejxyldqmrq = #{ejxyldqmrq}, a.xsqmyj = b.bjpyyj, a.xsqm = #{xsqm}, a.xsqmrq = #{xsqmrq}, a.fdymc=#{fdymc}, a.fdygh=#{fdygh}, a.ejxyldgh=#{ejxyldgh}, a.ejxyldmc=#{ejxyldmc}, a.xsgh=#{xsgh}, a.xsmc=#{xsmc}, where a.id in #{id} update srs_knrd_apply set step = #{targetStep} ,bjpyyj = null ,fdyqm = null ,ejxyldqmyj = null ,ejxyldqm = null ,xsqmyj = null ,xsqm = null where id = #{id} and step = #{step} update srs_knrd_apply set step = 2, bjpyyj = null, fdyqm = null, ejxyldqmyj = null, ejxyldqm = null, xsqmyj = null, xsqm = null where id = #{id} and step > 2 update srs_knrd_apply set locked = 1, locked_time = now() where id = #{id} update srs_knrd_apply set locked = 0, locked_time = null where id = #{id} update srs_knrd_apply set sqrqm = #{qm} where sqrqm is not null and xh = #{gh} update srs_knrd_apply set fdyqm = #{qm} where fdyqm is not null and fdygh = #{gh} update srs_knrd_apply set ejxyldqm = #{qm} where ejxyldqm is not null and ejxyldgh = #{gh} update srs_knrd_apply set xsqm = #{qm} where xsqm is not null and xsgh = #{gh}