<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nantian.sc.cloud.admin.mapper.SysDeptMapper">
    <resultMap id="baseResultMap" type="com.nantian.sc.cloud.admin.api.entity.SysDept">
    <id property="deptId" column="dept_id"/>
    <result property="dictId" column="dict_id"/>
    <result property="name" column="name"/>
    <result property="sort" column="sort"/>
    <result property="createTime" column="create_time"/>
    <result property="updateTime" column="update_time"/>
    <result property="parentId" column="parent_id"/>
    <result property="delFlag" column="del_flag"/>
    <result property="updateTime" column="update_time"/>
    <result property="tenantId" column="tenant_id"/>
    </resultMap>

    <select id="getList" resultType="com.nantian.sc.cloud.admin.api.entity.SysDept">
        SELECT d.dept_id, d.name, d.sort, d.create_time, d.update_time, d.del_flag, d.parent_id, d.tenant_id
        FROM sys_dept d INNER JOIN sys_dept_relation s ON s.ancestor = #{deptId} and s.descendant = d.dept_id
        WHERE d.tenant_id = #{tenantId}
    </select>

</mapper>
