SysDeptMapper.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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
  10. <if test="ew.getSqlSelect != null">
  11. ${ew.getSqlSelect}
  12. </if>
  13. <if test="ew.getSqlSelect == null">
  14. *
  15. </if>
  16. from sys_dept ${ew.getCustomSqlSegment}
  17. </select>
  18. <select id="selectPageDeptList" resultMap="SysDeptResult">
  19. select
  20. <if test="ew.getSqlSelect != null">
  21. ${ew.getSqlSelect}
  22. </if>
  23. <if test="ew.getSqlSelect == null">
  24. *
  25. </if>
  26. from sys_dept ${ew.getCustomSqlSegment}
  27. </select>
  28. <select id="countDeptById" resultType="Long">
  29. select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId}
  30. </select>
  31. <select id="selectDeptListByRoleId" resultType="Long">
  32. select d.dept_id
  33. from sys_dept d
  34. left join sys_role_dept rd on d.dept_id = rd.dept_id
  35. where rd.role_id = #{roleId}
  36. <if test="deptCheckStrictly">
  37. 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})
  38. </if>
  39. order by d.parent_id, d.order_num
  40. </select>
  41. </mapper>