提交 | 用户 | 时间
|
9f7aa7
|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
吴 |
2 |
<!DOCTYPE mapper |
|
3 |
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
4 |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
5 |
<mapper namespace="com.billion.main.om.mapper.OmProductionOrderInfoMapper"> |
|
6 |
|
|
7 |
<resultMap type="OmProductionOrderInfo" id="OmProductionOrderInfoResult"> |
|
8 |
<result property="id" column="id" /> |
|
9 |
<result property="workOrderNo" column="work_order_no" /> |
|
10 |
<result property="salesOrderCode" column="sales_order_code" /> |
|
11 |
<result property="productCode" column="product_code" /> |
|
12 |
<result property="lineCode" column="line_code" /> |
|
13 |
<result property="planQty" column="plan_qty" /> |
|
14 |
<result property="planStartTime" column="plan_start_time" /> |
|
15 |
<result property="planEndTime" column="plan_end_time" /> |
|
16 |
<result property="orderStatus" column="order_status" /> |
|
17 |
<result property="createTime" column="create_time" /> |
|
18 |
<result property="updateTime" column="update_time" /> |
|
19 |
<result property="createBy" column="create_by" /> |
|
20 |
<result property="updateBy" column="update_by" /> |
|
21 |
<result property="remarks" column="remarks" /> |
|
22 |
<result property="delFlag" column="del_flag" /> |
|
23 |
</resultMap> |
|
24 |
|
|
25 |
<sql id="selectOmProductionOrderInfoVo"> |
b9df2f
|
26 |
select id,body_status,head_status,pre_status,body_qty,head_qty,pre_qty,work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info |
9f7aa7
|
27 |
</sql> |
吴 |
28 |
|
a2cd0f
|
29 |
<!-- 查询 order_status 为 1 且 plan_start_time 最早的一条记录 --> |
b9df2f
|
30 |
<select id="getBodyOrder" resultType="OmProductionOrderInfo"> |
a2cd0f
|
31 |
SELECT TOP 1 * |
H |
32 |
FROM om_production_order_info |
b9df2f
|
33 |
WHERE body_status IN (0,1) |
a2cd0f
|
34 |
ORDER BY plan_start_time ASC |
H |
35 |
</select> |
b9df2f
|
36 |
<select id="updateBodyStatus1" resultType="OmProductionOrderInfo"> |
H |
37 |
UPDATE o |
|
38 |
SET body_status = 1, body_qty = body_qty + 1 |
|
39 |
FROM om_production_order_info AS o |
|
40 |
INNER JOIN ( |
|
41 |
SELECT TOP 1 id |
|
42 |
FROM om_production_order_info |
|
43 |
WHERE body_status IN (0, 1) |
|
44 |
ORDER BY plan_start_time ASC |
|
45 |
) AS sub ON o.id = sub.id; |
|
46 |
</select> |
|
47 |
<select id="updateBodyStatus2" resultType="OmProductionOrderInfo"> |
|
48 |
UPDATE om_production_order_info |
|
49 |
SET body_status = 2 |
|
50 |
WHERE id = ( |
|
51 |
SELECT TOP 1 id |
|
52 |
FROM om_production_order_info |
|
53 |
WHERE body_status IN (0, 1) |
|
54 |
ORDER BY plan_start_time ASC |
|
55 |
); |
|
56 |
</select> |
|
57 |
<select id="getHeadOrder" resultType="OmProductionOrderInfo"> |
a2cd0f
|
58 |
SELECT TOP 1 * |
H |
59 |
FROM om_production_order_info |
b9df2f
|
60 |
WHERE head_status IN (0,1) |
a2cd0f
|
61 |
ORDER BY plan_start_time ASC |
H |
62 |
</select> |
b9df2f
|
63 |
<select id="updateHeadStatus1" resultType="OmProductionOrderInfo"> |
H |
64 |
UPDATE o |
|
65 |
SET head_status = 1, head_qty = head_qty + 1 |
|
66 |
FROM om_production_order_info AS o |
|
67 |
INNER JOIN ( |
|
68 |
SELECT TOP 1 id |
|
69 |
FROM om_production_order_info |
|
70 |
WHERE head_status IN (0, 1) |
|
71 |
ORDER BY plan_start_time ASC |
|
72 |
) AS sub ON o.id = sub.id; |
|
73 |
</select> |
|
74 |
<select id="updateHeadStatus2" resultType="OmProductionOrderInfo"> |
a2cd0f
|
75 |
UPDATE om_production_order_info |
b9df2f
|
76 |
SET head_status = 2 |
a2cd0f
|
77 |
WHERE id = ( |
H |
78 |
SELECT TOP 1 id |
|
79 |
FROM om_production_order_info |
b9df2f
|
80 |
WHERE head_status IN (0, 1) |
a2cd0f
|
81 |
ORDER BY plan_start_time ASC |
H |
82 |
); |
|
83 |
</select> |
b9df2f
|
84 |
<select id="getPreOrder" resultType="OmProductionOrderInfo"> |
H |
85 |
SELECT TOP 1 * |
a2cd0f
|
86 |
FROM om_production_order_info |
b9df2f
|
87 |
WHERE pre_status IN (0,1) |
H |
88 |
ORDER BY plan_start_time ASC |
|
89 |
</select> |
|
90 |
<select id="updatePreStatus1" resultType="OmProductionOrderInfo"> |
|
91 |
UPDATE o |
|
92 |
SET pre_status = 1, pre_qty = pre_qty + 1 |
|
93 |
FROM om_production_order_info AS o |
|
94 |
INNER JOIN ( |
|
95 |
SELECT TOP 1 id |
|
96 |
FROM om_production_order_info |
|
97 |
WHERE pre_status IN (0, 1) |
|
98 |
ORDER BY plan_start_time ASC |
|
99 |
) AS sub ON o.id = sub.id; |
|
100 |
</select> |
|
101 |
<select id="updatePreStatus2" resultType="OmProductionOrderInfo"> |
|
102 |
UPDATE om_production_order_info |
|
103 |
SET pre_status = 2 |
|
104 |
WHERE id = ( |
|
105 |
SELECT TOP 1 id |
|
106 |
FROM om_production_order_info |
|
107 |
WHERE pre_status IN (0, 1) |
|
108 |
ORDER BY plan_start_time ASC |
|
109 |
); |
a2cd0f
|
110 |
</select> |
H |
111 |
|
b9df2f
|
112 |
|
a2cd0f
|
113 |
|
9f7aa7
|
114 |
<select id="selectOmProductionOrderInfoList" parameterType="OmProductionOrderInfo" resultMap="OmProductionOrderInfoResult"> |
吴 |
115 |
<include refid="selectOmProductionOrderInfoVo"/> |
|
116 |
<where> |
|
117 |
<if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if> |
|
118 |
<if test="salesOrderCode != null and salesOrderCode != ''"> and sales_order_code = #{salesOrderCode}</if> |
|
119 |
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if> |
|
120 |
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> |
1e2ff5
|
121 |
and del_flag = 0 |
9f7aa7
|
122 |
</where> |
吴 |
123 |
</select> |
|
124 |
|
|
125 |
<select id="selectOmProductionOrderInfoById" parameterType="Long" resultMap="OmProductionOrderInfoResult"> |
|
126 |
<include refid="selectOmProductionOrderInfoVo"/> |
1e2ff5
|
127 |
where id = #{id} and del_flag = 0 |
9f7aa7
|
128 |
</select> |
吴 |
129 |
|
|
130 |
<insert id="insertOmProductionOrderInfo" parameterType="OmProductionOrderInfo" useGeneratedKeys="true" keyProperty="id"> |
|
131 |
insert into om_production_order_info |
|
132 |
<trim prefix="(" suffix=")" suffixOverrides=","> |
|
133 |
<if test="workOrderNo != null and workOrderNo != ''">work_order_no,</if> |
|
134 |
<if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code,</if> |
|
135 |
<if test="productCode != null and productCode != ''">product_code,</if> |
|
136 |
<if test="lineCode != null and lineCode != ''">line_code,</if> |
|
137 |
<if test="planQty != null">plan_qty,</if> |
|
138 |
<if test="planStartTime != null">plan_start_time,</if> |
|
139 |
<if test="planEndTime != null">plan_end_time,</if> |
|
140 |
<if test="orderStatus != null">order_status,</if> |
|
141 |
<if test="createTime != null">create_time,</if> |
|
142 |
<if test="updateTime != null">update_time,</if> |
|
143 |
<if test="createBy != null">create_by,</if> |
|
144 |
<if test="updateBy != null">update_by,</if> |
|
145 |
<if test="remarks != null">remarks,</if> |
|
146 |
<if test="delFlag != null">del_flag,</if> |
|
147 |
</trim> |
|
148 |
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|
149 |
<if test="workOrderNo != null and workOrderNo != ''">#{workOrderNo},</if> |
|
150 |
<if test="salesOrderCode != null and salesOrderCode != ''">#{salesOrderCode},</if> |
|
151 |
<if test="productCode != null and productCode != ''">#{productCode},</if> |
|
152 |
<if test="lineCode != null and lineCode != ''">#{lineCode},</if> |
|
153 |
<if test="planQty != null">#{planQty},</if> |
|
154 |
<if test="planStartTime != null">#{planStartTime},</if> |
|
155 |
<if test="planEndTime != null">#{planEndTime},</if> |
|
156 |
<if test="orderStatus != null">#{orderStatus},</if> |
|
157 |
<if test="createTime != null">#{createTime},</if> |
|
158 |
<if test="updateTime != null">#{updateTime},</if> |
|
159 |
<if test="createBy != null">#{createBy},</if> |
|
160 |
<if test="updateBy != null">#{updateBy},</if> |
|
161 |
<if test="remarks != null">#{remarks},</if> |
|
162 |
<if test="delFlag != null">#{delFlag},</if> |
|
163 |
</trim> |
|
164 |
</insert> |
|
165 |
|
|
166 |
<update id="updateOmProductionOrderInfo" parameterType="OmProductionOrderInfo"> |
|
167 |
update om_production_order_info |
|
168 |
<trim prefix="SET" suffixOverrides=","> |
|
169 |
<if test="workOrderNo != null and workOrderNo != ''">work_order_no = #{workOrderNo},</if> |
|
170 |
<if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code = #{salesOrderCode},</if> |
|
171 |
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if> |
|
172 |
<if test="lineCode != null and lineCode != ''">line_code = #{lineCode},</if> |
|
173 |
<if test="planQty != null">plan_qty = #{planQty},</if> |
|
174 |
<if test="planStartTime != null">plan_start_time = #{planStartTime},</if> |
|
175 |
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if> |
|
176 |
<if test="orderStatus != null">order_status = #{orderStatus},</if> |
|
177 |
<if test="createTime != null">create_time = #{createTime},</if> |
|
178 |
<if test="updateTime != null">update_time = #{updateTime},</if> |
|
179 |
<if test="createBy != null">create_by = #{createBy},</if> |
|
180 |
<if test="updateBy != null">update_by = #{updateBy},</if> |
|
181 |
<if test="remarks != null">remarks = #{remarks},</if> |
|
182 |
<if test="delFlag != null">del_flag = #{delFlag},</if> |
|
183 |
</trim> |
|
184 |
where id = #{id} |
|
185 |
</update> |
|
186 |
|
|
187 |
<update id="deleteOmProductionOrderInfoById" parameterType="Long"> |
1e2ff5
|
188 |
update om_production_order_info set del_flag = 1 where id = #{id} |
9f7aa7
|
189 |
</update> |
吴 |
190 |
|
|
191 |
<update id="deleteOmProductionOrderInfoByIds" parameterType="String"> |
1e2ff5
|
192 |
update om_production_order_info set del_flag = 1 where id in |
9f7aa7
|
193 |
<foreach item="id" collection="array" open="(" separator="," close=")"> |
吴 |
194 |
#{id} |
|
195 |
</foreach> |
|
196 |
</update> |
|
197 |
</mapper> |