select d.id, u1.nick_name confirm1_name, u2.nick_name confirm2_name, d.sub_id, d.approve_id, d.check_content, d.check_result, d.confirm1, d.confirm2, d.confirmation_date, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.approve_status ,s.dept_name from t_pssr_protection d
left join sys_dept s on s.dept_id = d.dept_id
left join sys_user u1 on u1.user_id = d.CONFIRM1
left join sys_user u2 on u2.user_id = d.CONFIRM2
SELECT seq_t_pssr_protection.NEXTVAL as id FROM DUAL
insert into t_pssr_protection
id,
sub_id,
approve_id,
check_content,
check_result,
confirm1,
confirm2,
confirmation_date,
del_flag,
creater_code,
createdate,
updater_code,
updatedate,
dept_id,
remarks,
approve_status,
#{id},
#{subId},
#{approveId},
#{checkContent},
#{checkResult},
#{confirm1},
#{confirm2},
#{confirmationDate},
#{delFlag},
#{createrCode},
#{createdate},
#{updaterCode},
#{updatedate},
#{deptId},
#{remarks},
#{approveStatus},
update t_pssr_protection
sub_id = #{subId},
approve_id = #{approveId},
check_content = #{checkContent},
check_result = #{checkResult},
confirm1 = #{confirm1},
confirm2 = #{confirm2},
confirmation_date = #{confirmationDate},
del_flag = #{delFlag},
creater_code = #{createrCode},
createdate = #{createdate},
updater_code = #{updaterCode},
updatedate = #{updatedate},
dept_id = #{deptId},
remarks = #{remarks},
approve_status = #{approveStatus},
where id = #{id}
update t_pssr_protection
confirm1 = #{confirm1},
confirm2 = #{confirm2},
confirmation_date = #{confirmationDate},
creater_code = #{createrCode},
createdate = #{createdate},
updater_code = #{updaterCode},
updatedate = #{updatedate},
remarks = #{remarks},
where id in
#{id}
update T_PSSR_PROTECTION
approve_status = #{approveStatus},
updater_code = #{updaterCode},
updatedate = #{updatedate},
where sub_id= #{subId} and APPROVE_STATUS=0
update t_pssr_protection set del_flag = 2 where id = #{id}
update t_pssr_protection set del_flag = 2 where id in
#{id}