SysDeptMapper.xml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 t_sys_dept ${ew.getCustomSqlSegment}
  17. </select>
  18. <select id="countDeptById" resultType="Long">
  19. select count(*) from t_sys_dept where del_flag = '0' and dept_id = #{deptId}
  20. </select>
  21. <select id="selectDeptListByRoleId" resultType="Long">
  22. select d.dept_id
  23. from t_sys_dept d
  24. left join sys_role_dept rd on d.dept_id = rd.dept_id
  25. where rd.role_id = #{roleId}
  26. <if test="deptCheckStrictly">
  27. and d.dept_id not in (select d.parent_id from t_sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
  28. </if>
  29. order by d.parent_id, d.order_num
  30. </select>
  31. <select id="selectVoAllByOtherId" resultMap="SysDeptResult">
  32. select * from t_sys_dept where other_id=#{otherId}
  33. </select>
  34. </mapper>