select d.id, s.name, t.courseid, t.course, t.course_startdate, t.trainer, t.duration, t.years, d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary from t_training_device d left join t_training t on t.id = d.regular_id left join t_staffmgr s on s.staffid = t.trainer SELECT seq_t_training_device.NEXTVAL as id FROM DUAL insert into t_training_device id, staff_id, regular_id, start_date, remarks, del_flag, creater_code, createdate, updater_code, updatedate, supplementary, #{id}, #{staffId}, #{regularId}, #{startDate}, #{remarks}, #{delFlag}, #{createrCode}, #{createdate}, #{updaterCode}, #{updatedate}, #{supplementary}, update t_training_device staff_id = #{staffId}, regular_id = #{regularId}, start_date = #{startDate}, start_date = NULL, remarks = #{remarks}, del_flag = #{delFlag}, creater_code = #{createrCode}, createdate = #{createdate}, updater_code = #{updaterCode}, updatedate = #{updatedate}, supplementary = #{supplementary}, where id = #{id} update t_training_device set del_flag = 2 where id = #{id} update t_training_device set del_flag = 2 where regular_id = #{regularId} update t_training_device set del_flag = 2 where id in #{id}