xm
2024-06-14 722af26bc6fec32bb289b1df51a9016a4935610f
提交 | 用户 | 时间
722af2 1 <?xml version="1.0" encoding="UTF-8" ?>
X 2 <!DOCTYPE mapper
3         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.dl.system.mapper.SysDeptMapper">
6
7     <resultMap type="SysDept" id="SysDeptResult">
8         <id property="deptId" column="dept_id"/>
9         <result property="parentId" column="parent_id"/>
10         <result property="ancestors" column="ancestors"/>
11         <result property="deptName" column="dept_name"/>
12         <result property="orderNum" column="order_num"/>
13         <result property="leader" column="leader"/>
14         <result property="phone" column="phone"/>
15         <result property="email" column="email"/>
16         <result property="status" column="status"/>
17         <result property="delFlag" column="del_flag"/>
18         <result property="parentName" column="parent_name"/>
19         <result property="createBy" column="create_by"/>
20         <result property="createTime" column="create_time"/>
21         <result property="updateBy" column="update_by"/>
22         <result property="updateTime" column="update_time"/>
23     </resultMap>
24
25     <select id="selectDeptList" resultMap="SysDeptResult">
26         select * from sys_dept ${ew.getCustomSqlSegment}
27     </select>
28
29     <select id="selectDeptListByRoleId" resultType="Long">
30         select d.dept_id
31         from sys_dept d
32             left join sys_role_dept rd on d.dept_id = rd.dept_id
33         where rd.role_id = #{roleId}
34             <if test="deptCheckStrictly">
35                 and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
36             </if>
37         order by d.parent_id, d.order_num
38     </select>
39
40 </mapper>