XiaoRuby
2023-08-23 aa1e06a5cf1026af055e731586dcaf48c3e92b57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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.yuanchu.limslaboratory.mapper.OrganizationalMapper">
 
    <resultMap id="OrganizationalMap" type="map">
        <id property="id" column="id"/>
        <result property="department" column="department"/>
        <collection property="children" select="OrganizationalTree" column="id" javaType="list"/>
    </resultMap>
 
    <select id="OrganizationalTree" resultMap="OrganizationalMap">
        SELECT o.id, o.`department` FROM organizational o where o.`father_id` = #{father_id}
    </select>
</mapper>