select dw.id, dw.project_id, dw.dept_id, d.dept_name, dw.service_personnel, dw.supervisor_personnel, dw.contractor_personnel, dw.create_by, dw.create_time, dw.update_by, dw.update_time, dw.remark from sur_project_dept_wroks dw left join sys_dept d on d.dept_id=dw.dept_id insert into sur_project_dept_wroks project_id, dept_id, service_personnel, supervisor_personnel, contractor_personnel, create_by, create_time, update_by, update_time, remark, #{projectId}, #{deptId}, #{servicePersonnel}, #{supervisorPersonnel}, #{contractorPersonnel}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark}, update sur_project_dept_wroks project_id = #{projectId}, dept_id = #{deptId}, service_personnel = #{servicePersonnel}, supervisor_personnel = #{supervisorPersonnel}, contractor_personnel = #{contractorPersonnel}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, where id = #{id} delete from sur_project_dept_wroks where id = #{id} delete from sur_project_dept_wroks where project_id = #{projectId} and dept_id = #{deptId} delete from sur_project_dept_wroks where id in #{id} UPDATE sur_project sp SET sp.servicePersonnel = sp.servicePersonnel+#{servicePersonnel}, sp.supervisorPersonnel = sp.supervisorPersonnel+#{supervisorPersonnel}, sp.generalContractor = sp.generalContractor+#{contractorPersonnel} WHERE id = #{projectId} UPDATE sur_project sp SET sp.servicePersonnel = sp.servicePersonnel-#{oldServicePersonnel}+#{servicePersonnel}, sp.supervisorPersonnel = sp.supervisorPersonnel-#{oldSupervisorPersonnel}+#{supervisorPersonnel}, sp.generalContractor = sp.generalContractor-#{oldContractorPersonnel}+#{contractorPersonnel} WHERE id = #{projectId}