zss
2023-08-11 24a1aa1d7470998522aa28b4abc728fff5bcbaf7
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
31
32
33
34
35
36
37
<?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.mom.mapper.DeviceMapper">
 
    <select id="selectDeviceTables" resultType="map">
        SELECT d.`id`, d.`name`, d.`father`,t.`quota`
        FROM device d, technology t
        WHERE d.`state` = 1
          AND d.`id` = t.`device_id`
    </select>
 
    <resultMap id="deviceTwoTreeOneMap" type="map">
        <id property="father" column="father"/>
        <collection property="children" resultMap="deviceTwoTreeTwoMap" javaType="List"/>
    </resultMap>
 
    <resultMap id="deviceTwoTreeTwoMap" type="map">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
    </resultMap>
 
    <select id="deviceTwoTree" resultMap="deviceTwoTreeOneMap">
        SELECT d.`id`, d.`name`, d.`father`
        FROM device d
        WHERE d.state = 1
        AND d.type = #{type}
    </select>
 
    <select id="DevicePageList" resultType="Map">
        SELECT * FROM device d
                          LEFT JOIN raw_ins_product r
                                    ON d.`id` = r.`device_id`
        WHERE r.`test_state` IS NULL
          AND d.`state` = 1
          AND (r.`state` = 1 OR r.`state` IS NULL)
    </select>
</mapper>