TopSysDeptMapper.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?xml version="1.0" encoding="UTF-8" ?>
  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.zhongzheng.modules.top.user.mapper.TopSysDeptMapper">
  6. <resultMap type="com.zhongzheng.modules.top.user.domain.TopSysDept" id="TopSysDeptResult">
  7. <result property="deptId" column="dept_id"/>
  8. <result property="parentId" column="parent_id"/>
  9. <result property="ancestors" column="ancestors"/>
  10. <result property="deptName" column="dept_name"/>
  11. <result property="orderNum" column="order_num"/>
  12. <result property="leader" column="leader"/>
  13. <result property="phone" column="phone"/>
  14. <result property="email" column="email"/>
  15. <result property="status" column="status"/>
  16. <result property="delFlag" column="del_flag"/>
  17. <result property="createBy" column="create_by"/>
  18. <result property="createTime" column="create_time"/>
  19. <result property="updateBy" column="update_by"/>
  20. <result property="updateTime" column="update_time"/>
  21. </resultMap>
  22. <select id="selectDeptListByRoleId" resultType="Integer">
  23. select d.dept_id
  24. from top_sys_dept d
  25. left join top_sys_role_dept rd on d.dept_id = rd.dept_id
  26. where rd.role_id = #{roleId}
  27. <if test="deptCheckStrictly">
  28. and d.dept_id not in (select d.parent_id from top_sys_dept d inner join sys_role_dept rd on d.dept_id =
  29. rd.dept_id and rd.role_id = #{roleId})
  30. </if>
  31. order by d.parent_id, d.order_num
  32. </select>
  33. </mapper>