long
2023-09-02 e379948bb83ebcc9ce0c467a7b970f74bc00e9a1
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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="cn.stylefeng.guns.modular.dq.materialTraceability.mapper.MaterialTraceabilityMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.stylefeng.guns.modular.dq.materialTraceability.entity.MaterialTraceability">
        <id column="id" property="id" />
        <result column="product_no" property="productNo" />
        <result column="housing_bar_code" property="housingBarCode" />
        <result column="work_order_no" property="workOrderNo" />
        <result column="product_code" property="productCode" />
        <result column="product_name" property="productName" />
        <result column="line_code" property="lineCode" />
        <result column="line_name" property="lineName" />
        <result column="location_code" property="locationCode" />
        <result column="location_name" property="locationName" />
        <result column="material_code" property="materialCode" />
        <result column="material_name" property="materialName" />
        <result column="material_batch_no" property="materialBatchNo" />
        <result column="material_serial_no" property="materialSerialNo" />
        <result column="assembly_qty" property="assemblyQty" />
        <result column="assembly_user" property="assemblyUser" />
        <result column="assembly_time" property="assemblyTime" />
        <result column="spare_field_1" property="spareField1" />
        <result column="spare_field_2" property="spareField2" />
        <result column="spare_field_3" property="spareField3" />
        <result column="spare_field_4" property="spareField4" />
        <result column="remarks" property="remarks" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id AS "id", product_no AS "productNo", housing_bar_code AS "housingBarCode", work_order_no AS "workOrderNo", product_code AS "productCode", product_name AS "productName", line_code AS "lineCode", line_name AS "lineName", location_code AS "locationCode", location_name AS "locationName", material_code AS "materialCode", material_name AS "materialName", material_batch_no AS "materialBatchNo", material_serial_no AS "materialSerialNo", assembly_qty AS "assemblyQty", assembly_user AS "assemblyUser", assembly_time AS "assemblyTime", spare_field_1 AS "spareField1", spare_field_2 AS "spareField2", spare_field_3 AS "spareField3", spare_field_4 AS "spareField4", remarks AS "remarks"
    </sql>
 
 
    <select id="customList" resultType="cn.stylefeng.guns.modular.dq.materialTraceability.model.result.MaterialTraceabilityResult" parameterType="cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam">
        select
        <include refid="Base_Column_List"/>
        from dq_material_traceability where 1 = 1
        <if test="paramCondition.productNo != null and paramCondition.productNo != ''">
            and product_no like CONCAT('%',#{paramCondition.productNo},'%')
        </if>
        <if test="paramCondition.materialCode != null and paramCondition.materialCode != ''">
            and material_code like CONCAT('%',#{paramCondition.materialCode},'%')
        </if>
        <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
            and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
        </if>
        <if test="paramCondition.materialBatchNo != null and paramCondition.materialBatchNo != ''">
            and material_batch_no like CONCAT('%',#{paramCondition.materialBatchNo},'%')
        </if>
        <if test="paramCondition.materialSerialNo != null and paramCondition.materialSerialNo != ''">
            and material_serial_no like CONCAT('%',#{paramCondition.materialSerialNo},'%')
        </if>
        <if test="paramCondition.startTime != null and paramCondition.startTime != ''">
            and assembly_time &gt;= #{paramCondition.startTime}
        </if>
        <if test="paramCondition.endTime != null and paramCondition.endTime != ''">
            and assembly_time &lt;= #{paramCondition.endTime}
        </if>
    </select>
 
    <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam">
        select
        <include refid="Base_Column_List"/>
        from dq_material_traceability where 1 = 1
    </select>
 
    <select id="customPageList" resultType="cn.stylefeng.guns.modular.dq.materialTraceability.model.result.MaterialTraceabilityResult" parameterType="cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam">
        select
        <include refid="Base_Column_List"/>
        from dq_material_traceability where 1 = 1
        <if test="paramCondition.productNo != null and paramCondition.productNo != ''">
            and product_no like CONCAT('%',#{paramCondition.productNo},'%')
        </if>
        <if test="paramCondition.workOrderNo != null and paramCondition.workOrderNo != ''">
            and work_order_no like CONCAT('%',#{paramCondition.workOrderNo},'%')
        </if>
        <if test="paramCondition.materialBatchNo != null and paramCondition.materialBatchNo != ''">
            and material_batch_no like CONCAT('%',#{paramCondition.materialBatchNo},'%')
        </if>
        <if test="paramCondition.materialSerialNo != null and paramCondition.materialSerialNo != ''">
            and material_serial_no like CONCAT('%',#{paramCondition.materialSerialNo},'%')
        </if>
        <if test="paramCondition.startTime != null and paramCondition.startTime != ''">
            and assembly_time &gt;= #{paramCondition.startTime}
        </if>
        <if test="paramCondition.endTime != null and paramCondition.endTime != ''">
            and assembly_time &lt;= #{paramCondition.endTime}
        </if>
    </select>
 
    <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam">
        select
        <include refid="Base_Column_List"/>
        from dq_material_traceability where 1 = 1
    </select>
    <update id="updateSFC">
        update dq_material_traceability set product_no = #{sfcCode} where product_no = #{childSfcCode}
    </update>
 
</mapper>