提交 | 用户 | 时间
|
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"> |
|
26 |
select id, 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 |
|
27 |
</sql> |
|
28 |
|
a2cd0f
|
29 |
<!-- 查询 order_status 为 1 且 plan_start_time 最早的一条记录 --> |
H |
30 |
<select id="selectEarliestOrder" resultType="OmProductionOrderInfo"> |
|
31 |
SELECT TOP 1 * |
|
32 |
FROM om_production_order_info |
|
33 |
WHERE order_status IN (1, 2) |
|
34 |
ORDER BY plan_start_time ASC |
|
35 |
</select> |
|
36 |
|
|
37 |
<select id="selectEarliestOrder2" resultType="OmProductionOrderInfo"> |
|
38 |
SELECT TOP 1 * |
|
39 |
FROM om_production_order_info |
|
40 |
WHERE order_status IN (5) |
|
41 |
ORDER BY plan_start_time ASC |
|
42 |
</select> |
|
43 |
|
|
44 |
<select id="updateOrderStatus" resultType="OmProductionOrderInfo"> |
|
45 |
UPDATE om_production_order_info |
|
46 |
SET order_status = 5 |
|
47 |
WHERE id = ( |
|
48 |
SELECT TOP 1 id |
|
49 |
FROM om_production_order_info |
|
50 |
WHERE order_status IN (1, 2) |
|
51 |
ORDER BY plan_start_time ASC |
|
52 |
); |
|
53 |
</select> |
|
54 |
<select id="updateOrderStatus2" resultType="OmProductionOrderInfo"> |
|
55 |
UPDATE om_production_order_info |
|
56 |
SET order_status = 2 |
|
57 |
WHERE id = ( |
|
58 |
SELECT TOP 1 id |
|
59 |
FROM om_production_order_info |
|
60 |
WHERE order_status IN (1, 2) |
|
61 |
ORDER BY plan_start_time ASC |
|
62 |
); |
|
63 |
</select> |
|
64 |
|
|
65 |
<select id="getSerialNumber" resultType="OmProductionOrderInfo"> |
|
66 |
SELECT * |
|
67 |
FROM om_production_order_info |
|
68 |
WHERE id = 1 |
|
69 |
</select> |
|
70 |
|
|
71 |
<select id="updateSerialNumber" resultType="OmProductionOrderInfo"> |
|
72 |
UPDATE om_production_order_info |
|
73 |
SET plan_qty = plan_qty + 1 |
|
74 |
WHERE id = 1; |
|
75 |
</select> |
|
76 |
<select id="updateYear" resultType="OmProductionOrderInfo"> |
|
77 |
UPDATE om_production_order_info |
|
78 |
SET remarks = remarks + 1, |
|
79 |
qty = 1 |
|
80 |
WHERE id = 1; |
|
81 |
</select> |
|
82 |
|
|
83 |
|
9f7aa7
|
84 |
<select id="selectOmProductionOrderInfoList" parameterType="OmProductionOrderInfo" resultMap="OmProductionOrderInfoResult"> |
吴 |
85 |
<include refid="selectOmProductionOrderInfoVo"/> |
|
86 |
<where> |
|
87 |
<if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if> |
|
88 |
<if test="salesOrderCode != null and salesOrderCode != ''"> and sales_order_code = #{salesOrderCode}</if> |
|
89 |
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if> |
|
90 |
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> |
1e2ff5
|
91 |
and del_flag = 0 |
9f7aa7
|
92 |
</where> |
吴 |
93 |
</select> |
|
94 |
|
|
95 |
<select id="selectOmProductionOrderInfoById" parameterType="Long" resultMap="OmProductionOrderInfoResult"> |
|
96 |
<include refid="selectOmProductionOrderInfoVo"/> |
1e2ff5
|
97 |
where id = #{id} and del_flag = 0 |
9f7aa7
|
98 |
</select> |
吴 |
99 |
|
|
100 |
<insert id="insertOmProductionOrderInfo" parameterType="OmProductionOrderInfo" useGeneratedKeys="true" keyProperty="id"> |
|
101 |
insert into om_production_order_info |
|
102 |
<trim prefix="(" suffix=")" suffixOverrides=","> |
|
103 |
<if test="workOrderNo != null and workOrderNo != ''">work_order_no,</if> |
|
104 |
<if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code,</if> |
|
105 |
<if test="productCode != null and productCode != ''">product_code,</if> |
|
106 |
<if test="lineCode != null and lineCode != ''">line_code,</if> |
|
107 |
<if test="planQty != null">plan_qty,</if> |
|
108 |
<if test="planStartTime != null">plan_start_time,</if> |
|
109 |
<if test="planEndTime != null">plan_end_time,</if> |
|
110 |
<if test="orderStatus != null">order_status,</if> |
|
111 |
<if test="createTime != null">create_time,</if> |
|
112 |
<if test="updateTime != null">update_time,</if> |
|
113 |
<if test="createBy != null">create_by,</if> |
|
114 |
<if test="updateBy != null">update_by,</if> |
|
115 |
<if test="remarks != null">remarks,</if> |
|
116 |
<if test="delFlag != null">del_flag,</if> |
|
117 |
</trim> |
|
118 |
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|
119 |
<if test="workOrderNo != null and workOrderNo != ''">#{workOrderNo},</if> |
|
120 |
<if test="salesOrderCode != null and salesOrderCode != ''">#{salesOrderCode},</if> |
|
121 |
<if test="productCode != null and productCode != ''">#{productCode},</if> |
|
122 |
<if test="lineCode != null and lineCode != ''">#{lineCode},</if> |
|
123 |
<if test="planQty != null">#{planQty},</if> |
|
124 |
<if test="planStartTime != null">#{planStartTime},</if> |
|
125 |
<if test="planEndTime != null">#{planEndTime},</if> |
|
126 |
<if test="orderStatus != null">#{orderStatus},</if> |
|
127 |
<if test="createTime != null">#{createTime},</if> |
|
128 |
<if test="updateTime != null">#{updateTime},</if> |
|
129 |
<if test="createBy != null">#{createBy},</if> |
|
130 |
<if test="updateBy != null">#{updateBy},</if> |
|
131 |
<if test="remarks != null">#{remarks},</if> |
|
132 |
<if test="delFlag != null">#{delFlag},</if> |
|
133 |
</trim> |
|
134 |
</insert> |
|
135 |
|
|
136 |
<update id="updateOmProductionOrderInfo" parameterType="OmProductionOrderInfo"> |
|
137 |
update om_production_order_info |
|
138 |
<trim prefix="SET" suffixOverrides=","> |
|
139 |
<if test="workOrderNo != null and workOrderNo != ''">work_order_no = #{workOrderNo},</if> |
|
140 |
<if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code = #{salesOrderCode},</if> |
|
141 |
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if> |
|
142 |
<if test="lineCode != null and lineCode != ''">line_code = #{lineCode},</if> |
|
143 |
<if test="planQty != null">plan_qty = #{planQty},</if> |
|
144 |
<if test="planStartTime != null">plan_start_time = #{planStartTime},</if> |
|
145 |
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if> |
|
146 |
<if test="orderStatus != null">order_status = #{orderStatus},</if> |
|
147 |
<if test="createTime != null">create_time = #{createTime},</if> |
|
148 |
<if test="updateTime != null">update_time = #{updateTime},</if> |
|
149 |
<if test="createBy != null">create_by = #{createBy},</if> |
|
150 |
<if test="updateBy != null">update_by = #{updateBy},</if> |
|
151 |
<if test="remarks != null">remarks = #{remarks},</if> |
|
152 |
<if test="delFlag != null">del_flag = #{delFlag},</if> |
|
153 |
</trim> |
|
154 |
where id = #{id} |
|
155 |
</update> |
|
156 |
|
|
157 |
<update id="deleteOmProductionOrderInfoById" parameterType="Long"> |
1e2ff5
|
158 |
update om_production_order_info set del_flag = 1 where id = #{id} |
9f7aa7
|
159 |
</update> |
吴 |
160 |
|
|
161 |
<update id="deleteOmProductionOrderInfoByIds" parameterType="String"> |
1e2ff5
|
162 |
update om_production_order_info set del_flag = 1 where id in |
9f7aa7
|
163 |
<foreach item="id" collection="array" open="(" separator="," close=")"> |
吴 |
164 |
#{id} |
|
165 |
</foreach> |
|
166 |
</update> |
|
167 |
</mapper> |