select d.new_id, d.staff_id, d.name,u.name as staffName,u2.name as mentorStaffName, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.plan_status, d.plan_year, d.startdate, d.enddate, d.mentor_staff_id, d.plan_type, d.remarks ,s.dept_name,
d.mentor_agreement_word_path, d.target_plan_word_path, appraisal_form_word_path
from t_ts_new d
left join sys_dept s on s.dept_id = d.dept_id
left join t_staffmgr u on d.staff_id = u.staffid and u.del_flag = 0
left join t_staffmgr u2 on d.mentor_staff_id = u2.staffid and u2.del_flag = 0
SELECT seq_t_ts_new.NEXTVAL as newId FROM DUAL
insert into t_ts_new
new_id,
staff_id,
name,
del_flag,
creater_code,
createdate,
updater_code,
updatedate,
dept_id,
plan_status,
plan_year,
startdate,
enddate,
mentor_staff_id,
plan_type,
remarks,
#{newId},
#{staffId},
#{name},
#{delFlag},
#{createrCode},
#{createdate},
#{updaterCode},
#{updatedate},
#{deptId},
#{planStatus},
#{planYear},
#{startdate},
#{enddate},
#{mentorStaffId},
#{planType},
#{remarks},
update t_ts_new
staff_id = #{staffId},
name = #{name},
del_flag = #{delFlag},
creater_code = #{createrCode},
createdate = #{createdate},
updater_code = #{updaterCode},
updatedate = #{updatedate},
dept_id = #{deptId},
plan_status = #{planStatus},
plan_year = #{planYear},
startdate = #{startdate},
enddate = #{enddate},
mentor_staff_id = #{mentorStaffId},
plan_type = #{planType},
remarks = #{remarks},
mentor_agreement_word_path = #{mentorAgreementWordPath},
target_plan_word_path = #{targetPlanWordPath},
appraisal_form_word_path = #{appraisalFormWordPath},
where new_id = #{newId}
update t_ts_new set del_flag = 2 where new_id = #{newId}
update t_ts_new set del_flag = 2 where new_id in
#{newId}