zss
2023-09-05 b9e2c1619cf61bcd5f24b858fff738244d20566e
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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.FinishedInspectMapper">
    <select id="selectFinishedInspectPage" resultType="map">
        SELECT f.`id`, f.`order_number`, f.`customer_name`, f.`project_name`, f.`quality_traceability`,
        f.`material_code`, f.`material`, f.`specifications_model`, f.`unit`,
        f.`quantity`, u.`name`, DATE_FORMAT(f.`create_time`, '%Y-%m-%d') detectionPeriod, f.`result`
        FROM finished_inspect f, `user` u
        WHERE f.`user_id` = u.`id`
        AND f.`state` = 1
        <if test="inspectResult != null and inspectResult != ''">
            AND f.result = #{inspectResult}
        </if>
        <if test="inspectDate != null and inspectDate != ''">
            AND DATE_FORMAT(f.`create_time`, '%Y-%m-%d') = #{inspectDate}
        </if>
        <if test="inspectUsername != null and inspectUsername != ''">
            AND u.`name` LIKE CONCAT('%',#{inspectUsername},'%')
        </if>
    </select>
    <select id="selCountFin" resultType="java.lang.Integer">
        select count(id)
        from mom_ocean.finished_inspect
        where state=1
        and result=#{result}
        and type=#{type}
        <if test="begin != null and begin!=''">
            and finished_inspect.create_time &gt;= #{begin}
        </if>
        <if test="end != null and end!=''">
            and finished_inspect.create_time &lt;= #{end}
        </if>
    </select>
    <select id="seAllCount" resultType="java.lang.Long">
        select count(id)
        from mom_ocean.finished_inspect
        where state=1
        and type=#{type}
        <if test="begin != null and begin!=''">
            and finished_inspect.create_time &gt;= #{begin}
        </if>
        <if test="end != null and end!=''">
            and finished_inspect.create_time &lt;= #{end}
        </if>
    </select>
    <!--新增过程检验单-根据订单号选择产品信息-->
    <resultMap id="oneMap" type="map">
        <id property="name" column="material"/>
        <result property="code" column="code"/>
        <result property="specifications" column="specifications"/>
        <result property="unit" column="unit"/>
        <collection property="children" resultMap="twoMap" javaType="List"/>
    </resultMap>
    <resultMap id="twoMap" type="map">
        <result property="name" column="techfather"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <resultMap id="threeMap" type="map">
        <id property="id" column="technologyId"/>
        <result property="name" column="techname"/>
    </resultMap>
    <select id="chooseMater" resultMap="oneMap">
        select mo.name material,
               code,
               specifications,
               unit,
               technology_id   technologyId,
               techfather,
               techname
        from mom_ocean.manual_technology mt
                 left join mom_ocean.manufacture_order mo on mt.manufacture_order_id = mo.id
                 left join mom_ocean.material m on m.name = mo.name
        where mo.state = 1
          and type = 1
          and order_code = #{orderNumber}
    </select>
</mapper>