Fixiaobai
2023-09-09 e7f7daae5d21ad2988cadd25b6987ca5e7ef8001
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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}
        and o.state = 1
    </select>
 
    <select id="getDepartmentListTable" resultType="map">
        SELECT o.`id`, o.`department`
        FROM organizational o
        WHERE o.`father_id` = #{departmentId}
          AND o.`state` = 1
    </select>
 
    <select id="deleteDepartment">
        update lims_laboratory.organizational
        set state=0
        where id in (${ids})
    </select>
</mapper>