SysDeptMapper.xml 1.1 KB

1234567891011121314151617181920212223242526272829
  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="org.dromara.system.mapper.SysDeptMapper">
  6. <resultMap type="org.dromara.system.domain.vo.SysDeptVo" id="SysDeptResult">
  7. </resultMap>
  8. <select id="selectDeptList" resultMap="SysDeptResult">
  9. select ${ew.getSqlSelect} from sys_dept ${ew.getCustomSqlSegment}
  10. </select>
  11. <select id="countDeptById" resultType="Long">
  12. select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId}
  13. </select>
  14. <select id="selectDeptListByRoleId" resultType="Long">
  15. select d.dept_id
  16. from sys_dept d
  17. left join sys_role_dept rd on d.dept_id = rd.dept_id
  18. where rd.role_id = #{roleId}
  19. <if test="deptCheckStrictly">
  20. 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})
  21. </if>
  22. order by d.parent_id, d.order_num
  23. </select>
  24. </mapper>