select d.new_id, d.staff_id, d.name, 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 from t_ts_new d
left join sys_dept s on s.dept_id = d.dept_id
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},
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}