select d.id, d.staff_id,t.name as staffName,m.name as mentorStaffName, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.actualpost, d.mentor_staff_id, d.state ,s.dept_name from t_st_successor d left join sys_dept s on s.dept_id = d.dept_id left join t_staffmgr t on t.staffid = d.staff_id left join t_staffmgr m on m.staffid = d.mentor_staff_id SELECT seq_t_st_successor.NEXTVAL as id FROM DUAL insert into t_st_successor id, staff_id, remarks, del_flag, creater_code, createdate, updater_code, updatedate, dept_id, actualpost, mentor_staff_id, state, #{id}, #{staffId}, #{remarks}, #{delFlag}, #{createrCode}, #{createdate}, #{updaterCode}, #{updatedate}, #{deptId}, #{actualpost}, #{mentorStaffId}, #{state}, update t_st_successor staff_id = #{staffId}, remarks = #{remarks}, del_flag = #{delFlag}, creater_code = #{createrCode}, createdate = #{createdate}, updater_code = #{updaterCode}, updatedate = #{updatedate}, dept_id = #{deptId}, actualpost = #{actualpost}, mentor_staff_id = #{mentorStaffId}, state = #{state}, where id = #{id} update t_st_successor set del_flag = 2 where id = #{id} update t_st_successor set del_flag = 2 where id in #{id}