<?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="top.continew.admin.system.mapper.DeptMapper">

    <select id="selectDoById" resultType="top.continew.admin.system.model.entity.DeptDO">
        select *
        from sys_dept
        where FIND_IN_SET(id, (select ancestors from sys_dept where id = #{id}))
          and parent_id = 0
    </select>

    <select id="selectParentsById" resultType="top.continew.admin.system.model.entity.DeptDO">
        select *
        from sys_dept
        where FIND_IN_SET(id, (select ancestors from sys_dept where id = #{id})) and status = 1
    </select>

</mapper>
