select d.repo_id, d.code, d.title, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name, (SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=1) AS radio_count, (SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=2) AS multi_count, (SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=3) AS judge_count from t_el_repo d left join sys_dept s on s.dept_id = d.dept_id SELECT seq_t_el_repo.NEXTVAL as repoId FROM DUAL insert into t_el_repo repo_id, code, title, del_flag, creater_code, createdate, updater_code, updatedate, dept_id, remarks, #{repoId}, #{code}, #{title}, #{delFlag}, #{createrCode}, #{createdate}, #{updaterCode}, #{updatedate}, #{deptId}, #{remarks}, update t_el_repo code = #{code}, title = #{title}, del_flag = #{delFlag}, creater_code = #{createrCode}, createdate = #{createdate}, updater_code = #{updaterCode}, updatedate = #{updatedate}, dept_id = #{deptId}, remarks = #{remarks}, where repo_id = #{repoId} update t_el_repo set del_flag = 2 where repo_id = #{repoId} update t_el_repo set del_flag = 2 where repo_id in #{repoId}