sfd
2025-05-26 2a64b537e8e3bce9ce030585a3da17d48379c0ad
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?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.aps.core.mapper.ApsWeldSeamMapper">
    
    <resultMap type="com.aps.core.domain.ApsWeldSeam" id="ApsWeldSeamResult">
        <result property="id"    column="id"    />
        <result property="workOrderType"    column="work_order_type"    />
        <result property="materialCode"    column="material_code"    />
        <result property="customerDrawingNumber"    column="customer_drawing_number"    />
        <result property="organizeNumber"    column="organize_number"    />
        <result property="productionBase"    column="production_base"    />
        <result property="classification"    column="classification"    />
        <result property="produceYear"    column="produce_year"    />
        <result property="produceMonth"    column="produce_month"    />
        <result property="productionQuantity"    column="production_quantity"    />
        <result property="customer"    column="customer"    />
        <result property="singleWeldSeam"    column="single_weld_seam"    />
        <result property="totalWeldSeam"    column="total_weld_seam"    />
        <result property="thisFeedbackDay"    column="this_feedback_day"    />
        <result property="materialsRequirementDay"    column="materials_requirement_day"    />
        <result property="saleOrderNo"    column="sale_order_no"    />
        <result property="saleOrderLine"    column="sale_order_line"    />
        <result property="mainWorkOrderNo"    column="main_work_order_no"    />
        <result property="superiorWorkOrderNo"    column="superior_work_order_no"    />
        <result property="workOrderNo"    column="work_order_no"    />
        <result property="plant"    column="plant"    />
    </resultMap>
 
    <sql id="selectApsWeldSeamVo">
        select id, work_order_type, material_code, customer_drawing_number, organize_number, production_base, classification, produce_year, produce_month, production_quantity, customer, single_weld_seam, total_weld_seam, this_feedback_day, materials_requirement_day, sale_order_no, sale_order_line, main_work_order_no, superior_work_order_no, work_order_no, plant from aps_weld_seam
    </sql>
 
    <select id="selectApsWeldSeamList" parameterType="com.aps.core.domain.ApsWeldSeam" resultMap="ApsWeldSeamResult">
        <include refid="selectApsWeldSeamVo"/>
        <where>  
            <if test="workOrderType != null  and workOrderType != ''"> and work_order_type = #{workOrderType}</if>
            <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
            <if test="customerDrawingNumber != null  and customerDrawingNumber != ''"> and customer_drawing_number = #{customerDrawingNumber}</if>
            <if test="organizeNumber != null  and organizeNumber != ''"> and organize_number = #{organizeNumber}</if>
            <if test="productionBase != null  and productionBase != ''"> and production_base = #{productionBase}</if>
            <if test="classification != null  and classification != ''"> and classification = #{classification}</if>
            <if test="produceYear != null "> and produce_year = #{produceYear}</if>
            <if test="produceMonth != null "> and produce_month = #{produceMonth}</if>
            <if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if>
            <if test="customer != null  and customer != ''"> and customer = #{customer}</if>
            <if test="singleWeldSeam != null "> and single_weld_seam = #{singleWeldSeam}</if>
            <if test="totalWeldSeam != null "> and total_weld_seam = #{totalWeldSeam}</if>
            <if test="params.beginThisFeedbackDay != null and params.beginThisFeedbackDay != '' and params.endThisFeedbackDay != null and params.endThisFeedbackDay != ''"> and this_feedback_day between #{params.beginThisFeedbackDay} and #{params.endThisFeedbackDay}</if>
            <if test="params.beginMaterialsRequirementDay != null and params.beginMaterialsRequirementDay != '' and params.endMaterialsRequirementDay != null and params.endMaterialsRequirementDay != ''"> and materials_requirement_day between #{params.beginMaterialsRequirementDay} and #{params.endMaterialsRequirementDay}</if>
            <if test="saleOrderNo != null  and saleOrderNo != ''"> and sale_order_no = #{saleOrderNo}</if>
            <if test="saleOrderLine != null "> and sale_order_line = #{saleOrderLine}</if>
            <if test="mainWorkOrderNo != null  and mainWorkOrderNo != ''"> and main_work_order_no = #{mainWorkOrderNo}</if>
            <if test="superiorWorkOrderNo != null  and superiorWorkOrderNo != ''"> and superior_work_order_no = #{superiorWorkOrderNo}</if>
            <if test="workOrderNo != null  and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if>
            <if test="plant != null  and plant != ''"> and plant = #{plant}</if>
        </where>
    </select>
    
    <select id="selectApsWeldSeamById" parameterType="String" resultMap="ApsWeldSeamResult">
        <include refid="selectApsWeldSeamVo"/>
        where id = #{id}
    </select>
    <select id="selectApsWeldSeamByWorkOrderNo" parameterType="String" resultMap="ApsWeldSeamResult">
        <include refid="selectApsWeldSeamVo"/>
        where work_order_no = #{workOrderNo}
    </select>
    <insert id="insertApsWeldSeam" parameterType="com.aps.core.domain.ApsWeldSeam">
        insert into aps_weld_seam
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="workOrderType != null">work_order_type,</if>
            <if test="materialCode != null">material_code,</if>
            <if test="customerDrawingNumber != null">customer_drawing_number,</if>
            <if test="organizeNumber != null">organize_number,</if>
            <if test="productionBase != null">production_base,</if>
            <if test="classification != null">classification,</if>
            <if test="produceYear != null">produce_year,</if>
            <if test="produceMonth != null">produce_month,</if>
            <if test="productionQuantity != null">production_quantity,</if>
            <if test="customer != null">customer,</if>
            <if test="singleWeldSeam != null">single_weld_seam,</if>
            <if test="totalWeldSeam != null">total_weld_seam,</if>
            <if test="thisFeedbackDay != null">this_feedback_day,</if>
            <if test="materialsRequirementDay != null">materials_requirement_day,</if>
            <if test="saleOrderNo != null">sale_order_no,</if>
            <if test="saleOrderLine != null">sale_order_line,</if>
            <if test="mainWorkOrderNo != null">main_work_order_no,</if>
            <if test="superiorWorkOrderNo != null">superior_work_order_no,</if>
            <if test="workOrderNo != null">work_order_no,</if>
            <if test="plant != null">plant,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="workOrderType != null">#{workOrderType},</if>
            <if test="materialCode != null">#{materialCode},</if>
            <if test="customerDrawingNumber != null">#{customerDrawingNumber},</if>
            <if test="organizeNumber != null">#{organizeNumber},</if>
            <if test="productionBase != null">#{productionBase},</if>
            <if test="classification != null">#{classification},</if>
            <if test="produceYear != null">#{produceYear},</if>
            <if test="produceMonth != null">#{produceMonth},</if>
            <if test="productionQuantity != null">#{productionQuantity},</if>
            <if test="customer != null">#{customer},</if>
            <if test="singleWeldSeam != null">#{singleWeldSeam},</if>
            <if test="totalWeldSeam != null">#{totalWeldSeam},</if>
            <if test="thisFeedbackDay != null">#{thisFeedbackDay},</if>
            <if test="materialsRequirementDay != null">#{materialsRequirementDay},</if>
            <if test="saleOrderNo != null">#{saleOrderNo},</if>
            <if test="saleOrderLine != null">#{saleOrderLine},</if>
            <if test="mainWorkOrderNo != null">#{mainWorkOrderNo},</if>
            <if test="superiorWorkOrderNo != null">#{superiorWorkOrderNo},</if>
            <if test="workOrderNo != null">#{workOrderNo},</if>
            <if test="plant != null">#{plant},</if>
         </trim>
    </insert>
 
    <update id="updateApsWeldSeam" parameterType="com.aps.core.domain.ApsWeldSeam">
        update aps_weld_seam
        <trim prefix="SET" suffixOverrides=",">
            <if test="workOrderType != null">work_order_type = #{workOrderType},</if>
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="customerDrawingNumber != null">customer_drawing_number = #{customerDrawingNumber},</if>
            <if test="organizeNumber != null">organize_number = #{organizeNumber},</if>
            <if test="productionBase != null">production_base = #{productionBase},</if>
            <if test="classification != null">classification = #{classification},</if>
            <if test="produceYear != null">produce_year = #{produceYear},</if>
            <if test="produceMonth != null">produce_month = #{produceMonth},</if>
            <if test="productionQuantity != null">production_quantity = #{productionQuantity},</if>
            <if test="customer != null">customer = #{customer},</if>
            <if test="singleWeldSeam != null">single_weld_seam = #{singleWeldSeam},</if>
            <if test="totalWeldSeam != null">total_weld_seam = #{totalWeldSeam},</if>
            <if test="thisFeedbackDay != null">this_feedback_day = #{thisFeedbackDay},</if>
            <if test="materialsRequirementDay != null">materials_requirement_day = #{materialsRequirementDay},</if>
            <if test="saleOrderNo != null">sale_order_no = #{saleOrderNo},</if>
            <if test="saleOrderLine != null">sale_order_line = #{saleOrderLine},</if>
            <if test="mainWorkOrderNo != null">main_work_order_no = #{mainWorkOrderNo},</if>
            <if test="superiorWorkOrderNo != null">superior_work_order_no = #{superiorWorkOrderNo},</if>
            <if test="workOrderNo != null">work_order_no = #{workOrderNo},</if>
            <if test="plant != null">plant = #{plant},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteApsWeldSeamById" parameterType="String">
        delete from aps_weld_seam where id = #{id}
    </delete>
 
    <delete id="deleteApsWeldSeamByIds" parameterType="String">
        delete from aps_weld_seam where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <select id="weldSeamStat" parameterType="java.util.List" resultType="com.aps.core.domain.ApsWeldSeamStatistics">
        SELECT produce_year as year,
            produce_month as month,
            production_base as productionBase,
            work_order_type as workOrderType,
            classification,
        sum(total_weld_seam) as total
        FROM   aps_weld_seam where del_flag='0'
        GROUP BY produce_year, produce_month,   production_base,  work_order_type, classification
    </select>
    <update id="removeLastBatch" parameterType="String">
        update  aps_weld_seam set del_flag='1'    where  del_flag='0'
    </update>
 
    <select id="weldSeamEcharts" parameterType="java.util.List" resultType="map">
 
        SELECT
            seam.produce_year,
            seam.produce_month,
            seam.production_base,
            workOrderType.dict_label AS work_order_name,
            classification.dict_label AS classification_name,
            SUM ( seam.total_weld_seam ) AS total_weld_seam
        FROM
            aps_weld_seam seam
            LEFT JOIN sys_dict_data workOrderType ON seam.work_order_type = workOrderType.dict_value
            AND workOrderType.dict_type = 'aps_weld_work_order_type'
            LEFT JOIN sys_dict_data classification ON seam.classification = classification.dict_value
            AND classification.dict_type = 'aps_weld_classification'
            <where>
                seam.del_flag = '0'
                <foreach item="item" index="index" collection="list" separator=" OR " open="and (" close=") ">
                    produce_year = #{item.produceYear} and produce_month = #{item.produceMonth}
                </foreach>
            </where>
        GROUP BY
            seam.produce_year,
            seam.produce_month,
            seam.production_base,
            workOrderType.dict_label,
            classification.dict_label
 
    </select>
</mapper>