SysDeptMapper.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~
  4. ~ Copyright (c) 2018-2025, lengleng All rights reserved.
  5. ~
  6. ~ Redistribution and use in source and binary forms, with or without
  7. ~ modification, are permitted provided that the following conditions are met:
  8. ~
  9. ~ Redistributions of source code must retain the above copyright notice,
  10. ~ this list of conditions and the following disclaimer.
  11. ~ Redistributions in binary form must reproduce the above copyright
  12. ~ notice, this list of conditions and the following disclaimer in the
  13. ~ documentation and/or other materials provided with the distribution.
  14. ~ Neither the name of the pig4cloud.com developer nor the names of its
  15. ~ contributors may be used to endorse or promote products derived from
  16. ~ this software without specific prior written permission.
  17. ~ Author: lengleng (wangiegie@gmail.com)
  18. ~
  19. -->
  20. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  21. <mapper namespace="com.pig4cloud.pigx.admin.mapper.SysDeptMapper">
  22. <!-- 通用查询映射结果 -->
  23. <resultMap id="BaseResultMap" type="com.pig4cloud.pigx.admin.api.entity.SysDept">
  24. <id column="dept_id" property="deptId"/>
  25. <result column="name" property="name"/>
  26. <result column="sort" property="sort"/>
  27. <result column="create_time" property="createTime"/>
  28. <result column="update_time" property="updateTime"/>
  29. <result column="del_flag" property="delFlag"/>
  30. </resultMap>
  31. <!-- 通用查询结果列 -->
  32. <sql id="Base_Column_List">
  33. dept_id AS deptId, parent_id AS parentId, name, sort, create_time AS createTime, update_time AS updateTime, del_flag AS delFlag
  34. </sql>
  35. <!--关联查询部门列表-->
  36. <select id="listDepts" resultType="com.pig4cloud.pigx.admin.api.entity.SysDept">
  37. SELECT
  38. t.*
  39. FROM
  40. sys_dept t
  41. LEFT JOIN sys_dept_relation dr ON t.dept_id = dr.descendant
  42. WHERE dr.ancestor = 0
  43. </select>
  44. </mapper>