heheng
2025-06-17 b0a7fd07d39c45d57ff4b27cca3862a62caaffa1
multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -27,7 +27,7 @@
   </resultMap>
   <resultMap type="com.gkhy.exam.system.domain.vo.DeptVo" id="DeptVoResult" extends="SysDeptResult">
      <collection property="caluseVO1List" ofType="com.gkhy.exam.system.domain.vo.CaluseVO1">
         <id     property="clauseNum"     column="clause_num"     />
         <result     property="clauseNum"     column="clause_num"     />
         <result property="content"     column="content"     />
      </collection>
   </resultMap>
@@ -42,24 +42,24 @@
      select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id, d.company_id, d.status, d.del_flag, d.create_by, d.create_time,d.person_num,d.internal_auditors,
      d.responsibilities,u.name as leader_name,d2.dept_name as parent_name, dr.content ,dr.clause_num
      from sys_dept d
      left join sys_user u on d.leader_user_id = u.user_id
      left join sys_user u on d.leader_user_id = u.id
      left join sys_dept d2 on d.parent_id = d2.dept_id
      left join sys_dept_responsibility dr on d.dept_id = dr.dept_id and dr.del_flag = '0' and data_type = 2
        where d.del_flag = '0'
      <if test="companyId != null and companyId != 0">
         AND company_id = #{companyId}
         AND d.company_id = #{companyId}
      </if>
      <if test="deptId != null and deptId != 0">
         AND dept_id = #{deptId}
         AND d.dept_id = #{deptId}
      </if>
        <if test="parentId != null and parentId != 0">
         AND parent_id = #{parentId}
         AND d.parent_id = #{parentId}
      </if>
      <if test="deptName != null and deptName != ''">
         AND dept_name like concat('%', #{deptName}, '%')
         AND d.dept_name like concat('%', #{deptName}, '%')
      </if>
      <if test="status != null and status != ''">
         AND status = #{status}
         AND d.status = #{status}
      </if>
      order by d.parent_id, d.order_num
    </select>
@@ -131,7 +131,7 @@
      and del_flag = '0' limit 1
   </select>
    
    <insert id="insertDept" parameterType="com.gkhy.exam.common.domain.entity.SysDept">
    <insert id="insertDept" parameterType="com.gkhy.exam.common.domain.entity.SysDept" useGeneratedKeys="true" keyProperty="deptId">
       insert into sys_dept(
          <if test="deptId != null and deptId != 0">dept_id,</if>
          <if test="parentId != null and parentId != 0">parent_id,</if>
@@ -202,7 +202,7 @@
   </update>
   
   <delete id="deleteDeptById" parameterType="Long">
      update sys_dept set del_flag = '2' where dept_id = #{deptId}
      update sys_dept set del_flag = '1' where dept_id = #{deptId}
   </delete>
</mapper>