xiangpei
2025-02-14 12f73bafbe361f78d68a35de83ca3b3b4d4e0224
system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -65,6 +65,13 @@
      where d.dept_id = #{deptId}
   </select>
   <select id="selectDeptByIds" parameterType="Long" resultMap="SysDeptResult">
      select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
            (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
      from sys_dept d
      where d.dept_id in <foreach collection="deptIds" open="(" separator="," close=")" item="deptId">#{deptId}</foreach>
   </select>
    <select id="checkDeptExistUser" parameterType="Long" resultType="int">
      select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
   </select>
@@ -86,6 +93,12 @@
       <include refid="selectDeptVo"/>
      where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
   </select>
    <select id="selectAncestors" resultType="java.lang.String">
      select ancestors
      from sys_user SU
      INNER JOIN sys_dept SD ON SU.dept_id = SD.dept_id
      where SU.user_id = #{userId}
   </select>
    <insert id="insertDept" parameterType="SysDept">
       insert into sys_dept(