懒羊羊
2024-03-13 b64ed2c784bde6dea9d18149ca706ebe532c857d
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?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.jcdm.main.om.productionOrde.mapper.OmProductionOrdeInfoMapper">
    
    <resultMap type="OmProductionOrdeInfo" id="OmProductionOrdeInfoResult">
        <result property="id"    column="id"    />
        <result property="workOrderNo"    column="work_order_no"    />
        <result property="salesOrderCode"    column="sales_order_code"    />
        <result property="productCode"    column="product_code"    />
        <result property="productName"    column="product_name"    />
        <result property="workshopCode"    column="workshop_code"    />
        <result property="lineCode"    column="line_code"    />
        <result property="routeCode"    column="route_code"    />
        <result property="bomCode"    column="bom_code"    />
        <result property="recipeCode"    column="recipe_code"    />
        <result property="planQty"    column="plan_qty"    />
        <result property="actualQty"    column="actual_qty"    />
        <result property="badQty"    column="bad_qty"    />
        <result property="scrapQty"    column="scrap_qty"    />
        <result property="repairQty"    column="repair_qty"    />
        <result property="actualOnlineQty"    column="actual_online_qty"    />
        <result property="onlineCompletionMark"    column="online_completion_mark"    />
        <result property="demandDate"    column="demand_date"    />
        <result property="planStartTime"    column="plan_start_time"    />
        <result property="planEndTime"    column="plan_end_time"    />
        <result property="actualStartTime"    column="actual_start_time"    />
        <result property="actualEndTime"    column="actual_end_time"    />
        <result property="serialNumber"    column="serial_number"    />
        <result property="orderStatus"    column="order_status"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateUser"    column="update_user"    />
        <result property="remarks"    column="remarks"    />
        <result property="streamNumber"    column="stream_number"    />
        <result property="custom"    column="custom"    />
        <result property="marketAreaCode"    column="market_area_code"    />
        <result property="softwareVersionCode"    column="software_version_code"    />
        <result property="productCompanyCode"    column="product_company_code"    />
        <result property="spareField1"    column="spare_field_1"    />
        <result property="spareField2"    column="spare_field_2"    />
        <result property="spareField3"    column="spare_field_3"    />
        <result property="spareField4"    column="spare_field_4"    />
        <result property="siteCode"    column="site_code"    />
        <result property="productNum"    column="product_num"    />
        <result property="stationCode"    column="station_code"    />
        <result property="resultCode"    column="result_code"    />
        <result property="resultText"    column="result_text"    />
        <result property="sfResult"    column="sf_result"    />
        <result property="productModel"    column="product_model"    />
 
    </resultMap>
 
    <sql id="selectOmProductionOrdeInfoVo">
        select id,site_code,product_num,station_code, product_model,result_code,result_text,sf_result ,work_order_no, sales_order_code, product_code, product_name, workshop_code, line_code, route_code, bom_code, recipe_code, plan_qty, actual_qty, bad_qty, scrap_qty, repair_qty, actual_online_qty, online_completion_mark, demand_date, plan_start_time, plan_end_time, actual_start_time, actual_end_time, serial_number, order_status, create_time, update_time, create_user, update_user, remarks, stream_number, custom, market_area_code, software_version_code, product_company_code, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from om_production_orde_info
    </sql>
 
    <select id="selectOmProductionOrdeInfoList" parameterType="OmProductionOrdeInfo" resultMap="OmProductionOrdeInfoResult">
        <include refid="selectOmProductionOrdeInfoVo"/>
        <where>
            <if test="id != null  and id != ''"> and id like concat('%', #{id}, '%')</if>
            <if test="workOrderNo != null  and workOrderNo != ''"> and work_order_no like concat('%', #{workOrderNo}, '%')</if>
            <if test="salesOrderCode != null  and salesOrderCode != ''"> and sales_order_code like concat('%', #{salesOrderCode}, '%')</if>
            <if test="productCode != null  and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
            <if test="workshopCode != null  and workshopCode != ''"> and workshop_code like concat('%', #{workshopCode}, '%')</if>
            <if test="lineCode != null  and lineCode != ''"> and line_code like concat('%', #{lineCode}, '%')</if>
            <if test="routeCode != null  and routeCode != ''"> and route_code like concat('%', #{routeCode}, '%')</if>
            <if test="bomCode != null  and bomCode != ''"> and bom_code like concat('%', #{bomCode}, '%')</if>
            <if test="recipeCode != null  and recipeCode != ''"> and recipe_code like concat('%', #{recipeCode}, '%')</if>
            <if test="orderStatus != null  and orderStatus != ''"> and order_status = #{orderStatus}</if>
            <if test="custom != null  and custom != ''"> and custom like concat('%', #{custom}, '%')</if>
            <if test="marketAreaCode != null  and marketAreaCode != ''"> and market_area_code like concat('%', #{marketAreaCode}, '%')</if>
            <if test="softwareVersionCode != null  and softwareVersionCode != ''"> and software_version_code like concat('%', #{softwareVersionCode}, '%')</if>
            <if test="productCompanyCode != null  and productCompanyCode != ''"> and product_company_code like concat('%', #{productCompanyCode}, '%')</if>
            <if test="siteCode != null  and siteCode != ''"> and site_code = #{siteCode}</if>
            <if test="productNum != null  and productNum != ''"> and product_num = #{productNum}</if>
            <if test="stationCode != null  and stationCode != ''"> and station_code = #{stationCode}</if>
            <if test="resultText != null  and resultText != ''"> and result_text = #{resultText}</if>
            <if test="resultCode != null  and resultCode != ''"> and result_code = #{resultCode}</if>
            <if test="sfResult != null  and sfResult != ''"> and sf_result = #{sfResult}</if>
        </where>
        ORDER BY stream_number DESC
    </select>
    
    <select id="selectOmProductionOrdeInfoById" parameterType="Long" resultMap="OmProductionOrdeInfoResult">
        <include refid="selectOmProductionOrdeInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertOmProductionOrdeInfo" parameterType="OmProductionOrdeInfo">
        insert into om_production_orde_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="workOrderNo != null">work_order_no,</if>
            <if test="salesOrderCode != null">sales_order_code,</if>
            <if test="productCode != null">product_code,</if>
            <if test="productName != null">product_name,</if>
            <if test="workshopCode != null">workshop_code,</if>
            <if test="lineCode != null">line_code,</if>
            <if test="routeCode != null">route_code,</if>
            <if test="bomCode != null">bom_code,</if>
            <if test="recipeCode != null">recipe_code,</if>
            <if test="planQty != null">plan_qty,</if>
            <if test="actualQty != null">actual_qty,</if>
            <if test="badQty != null">bad_qty,</if>
            <if test="scrapQty != null">scrap_qty,</if>
            <if test="repairQty != null">repair_qty,</if>
            <if test="actualOnlineQty != null">actual_online_qty,</if>
            <if test="onlineCompletionMark != null">online_completion_mark,</if>
            <if test="demandDate != null">demand_date,</if>
            <if test="planStartTime != null">plan_start_time,</if>
            <if test="planEndTime != null">plan_end_time,</if>
            <if test="actualStartTime != null">actual_start_time,</if>
            <if test="actualEndTime != null">actual_end_time,</if>
            <if test="serialNumber != null">serial_number,</if>
            <if test="orderStatus != null">order_status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createUser != null">create_user,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="remarks != null">remarks,</if>
            <if test="streamNumber != null">stream_number,</if>
            <if test="custom != null">custom,</if>
            <if test="marketAreaCode != null">market_area_code,</if>
            <if test="softwareVersionCode != null">software_version_code,</if>
            <if test="productCompanyCode != null">product_company_code,</if>
            <if test="spareField1 != null">spare_field_1,</if>
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="spareField3 != null">spare_field_3,</if>
            <if test="spareField4 != null">spare_field_4,</if>
            <if test="siteCode != null">site_code,</if>
            <if test="productNum != null">product_num,</if>
            <if test="stationCode != null">station_code,</if>
            <if test="resultText != null">result_text,</if>
            <if test="resultCode != null">result_code,</if>
            <if test="sfResult != null">sf_result,</if>
            <if test="productModel != null">product_model,</if>
 
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="workOrderNo != null">#{workOrderNo},</if>
            <if test="salesOrderCode != null">#{salesOrderCode},</if>
            <if test="productCode != null">#{productCode},</if>
            <if test="productName != null">#{productName},</if>
            <if test="workshopCode != null">#{workshopCode},</if>
            <if test="lineCode != null">#{lineCode},</if>
            <if test="routeCode != null">#{routeCode},</if>
            <if test="bomCode != null">#{bomCode},</if>
            <if test="recipeCode != null">#{recipeCode},</if>
            <if test="planQty != null">#{planQty},</if>
            <if test="actualQty != null">#{actualQty},</if>
            <if test="badQty != null">#{badQty},</if>
            <if test="scrapQty != null">#{scrapQty},</if>
            <if test="repairQty != null">#{repairQty},</if>
            <if test="actualOnlineQty != null">#{actualOnlineQty},</if>
            <if test="onlineCompletionMark != null">#{onlineCompletionMark},</if>
            <if test="demandDate != null">#{demandDate},</if>
            <if test="planStartTime != null">#{planStartTime},</if>
            <if test="planEndTime != null">#{planEndTime},</if>
            <if test="actualStartTime != null">#{actualStartTime},</if>
            <if test="actualEndTime != null">#{actualEndTime},</if>
            <if test="serialNumber != null">#{serialNumber},</if>
            <if test="orderStatus != null">#{orderStatus},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="streamNumber != null">#{streamNumber},</if>
            <if test="custom != null">#{custom},</if>
            <if test="marketAreaCode != null">#{marketAreaCode},</if>
            <if test="softwareVersionCode != null">#{softwareVersionCode},</if>
            <if test="productCompanyCode != null">#{productCompanyCode},</if>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="spareField3 != null">#{spareField3},</if>
            <if test="spareField4 != null">#{spareField4},</if>
            <if test="siteCode != null">#{siteCode},</if>
            <if test="productNum != null">#{productNum},</if>
            <if test="stationCode != null">#{stationCode},</if>
            <if test="resultText != null">#{resultText},</if>
            <if test="resultCode != null">#{resultCode},</if>
            <if test="sfResult != null">#{sfResult},</if>
            <if test="productModel != null">#{productModel},</if>
 
        </trim>
    </insert>
 
    <update id="updateOmProductionOrdeInfo" parameterType="OmProductionOrdeInfo">
        update om_production_orde_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="workOrderNo != null">work_order_no = #{workOrderNo},</if>
            <if test="salesOrderCode != null">sales_order_code = #{salesOrderCode},</if>
            <if test="productCode != null">product_code = #{productCode},</if>
            <if test="productName != null">product_name = #{productName},</if>
            <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
            <if test="lineCode != null">line_code = #{lineCode},</if>
            <if test="routeCode != null">route_code = #{routeCode},</if>
            <if test="bomCode != null">bom_code = #{bomCode},</if>
            <if test="recipeCode != null">recipe_code = #{recipeCode},</if>
            <if test="planQty != null">plan_qty = #{planQty},</if>
            <if test="actualQty != null">actual_qty = #{actualQty},</if>
            <if test="badQty != null">bad_qty = #{badQty},</if>
            <if test="scrapQty != null">scrap_qty = #{scrapQty},</if>
            <if test="repairQty != null">repair_qty = #{repairQty},</if>
            <if test="actualOnlineQty != null">actual_online_qty = #{actualOnlineQty},</if>
            <if test="onlineCompletionMark != null">online_completion_mark = #{onlineCompletionMark},</if>
            <if test="demandDate != null">demand_date = #{demandDate},</if>
            <if test="planStartTime != null">plan_start_time = #{planStartTime},</if>
            <if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
            <if test="actualStartTime != null">actual_start_time = #{actualStartTime},</if>
            <if test="actualEndTime != null">actual_end_time = #{actualEndTime},</if>
            <if test="serialNumber != null">serial_number = #{serialNumber},</if>
            <if test="orderStatus != null">order_status = #{orderStatus},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="streamNumber != null">stream_number = #{streamNumber},</if>
            <if test="custom != null">custom = #{custom},</if>
            <if test="marketAreaCode != null">market_area_code = #{marketAreaCode},</if>
            <if test="softwareVersionCode != null">software_version_code = #{softwareVersionCode},</if>
            <if test="productCompanyCode != null">product_company_code = #{productCompanyCode},</if>
            <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
            <if test="spareField4 != null">spare_field_4 = #{spareField4},</if>
            <if test="siteCode != null">site_code = #{siteCode},</if>
            <if test="productNum != null">product_num = #{productNum},</if>
            <if test="stationCode != null">station_code = #{stationCode},</if>
            <if test="resultText != null">result_text = #{resultText},</if>
            <if test="resultCode != null">result_code = #{resultCode},</if>
            <if test="sfResult != null">sf_result = #{sfResult},</if>
            <if test="productModel != null">product_model = #{productModel},</if>
 
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteOmProductionOrdeInfoById" parameterType="Long">
        delete from om_production_orde_info where id = #{id}
    </delete>
 
    <delete id="deleteOmProductionOrdeInfoByIds" parameterType="String">
        delete from om_production_orde_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="getMaxStreamNumber" resultType="Integer">
        SELECT MAX(stream_number) AS streamNumber FROM om_production_orde_info
    </select>
</mapper>