zss
2023-09-25 44a9b4729e058e75dfba2892803038ee91963d77
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
38
39
40
41
42
43
44
45
46
47
<?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.InspectionItemMapper">
    <resultMap id="selectInspectionItemMap" type="inspectionItemDto">
        <id property="father" column="ifather"/>
        <association property="children" resultMap="selectInspectionItemDto2Map"/>
    </resultMap>
    <resultMap id="selectInspectionItemDto2Map" type="inspectionItemDto2">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="unit" column="unit"/>
        <result property="internal" column="internal"/>
        <result property="required" column="required"/>
        <result property="inspectionValue" column="inspection_value"/>
        <result property="did" column="did"/>
        <result property="dname" column="dname"/>
        <result property="result" column="result"/>
        <result property="username" column="username"/>
    </resultMap>
    <select id="selectInspectionItem" resultMap="selectInspectionItemMap">
        SELECT i.`id`,
               i.`father`  ifather,
               i.`name`,
               i.`unit`,
               i.`internal`,
               i.`required`,
               i.`inspection_value`,
               device.id   did,
               device.name dname,
               i.`result`,
               username
        FROM mom_ocean.inspection_item i
                 left join mom_ocean.device on i.device_id = device.id
        WHERE i.`inspect_id` = #{id}
          AND i.`state` = 1
          and i.type = #{type}
    </select>
 
    <!--获取该检验单下检验项目的结果集-->
    <select id="getResult" resultType="java.lang.Integer">
        select distinct result
        from mom_ocean.inspection_item
        where state = 1
          and type = #{type}
          and inspect_id = #{id}
    </select>
</mapper>