SysDeptMapper.xml 944 B

12345678910111213141516171819202122232425
  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.ruoyi.system.mapper.SysDeptMapper">
  6. <resultMap type="com.ruoyi.system.domain.vo.SysDeptVo" id="SysDeptResult">
  7. </resultMap>
  8. <select id="selectDeptList" resultMap="SysDeptResult">
  9. select * from sys_dept ${ew.getCustomSqlSegment}
  10. </select>
  11. <select id="selectDeptListByRoleId" resultType="Long">
  12. select d.dept_id
  13. from sys_dept d
  14. left join sys_role_dept rd on d.dept_id = rd.dept_id
  15. where rd.role_id = #{roleId}
  16. <if test="deptCheckStrictly">
  17. 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})
  18. </if>
  19. order by d.parent_id, d.order_num
  20. </select>
  21. </mapper>