InventoryTransactionMapper.xml
9.35 KB
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
<?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.huaheng.pc.inventory.inventoryTransaction.mapper.InventoryTransactionMapper">
<select id="selectListEntityByLike" resultType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction">
SELECT i.id, i.warehouseId, i.warehouseCode, i.locationId, i.locationCode, i.containerCode, i.sourceCode, i.sourceLine, i.type, i.companyId,
i.companyCode, i.billId, i.billCode, i.billDetailId, i.batch, i.lot, i.project, i.manufactureDate, i.expirationDate, i.status,
i.qty, i.taskQty, i.costPrice, i.listPrice, i.netPrice, i.created, i.createdBy, i.lastUpdated, i.lastUpdatedBy, i.userDef1,
i.userDef2, i.userDef3, i.materialId, i.materialCode, m.name AS 'materialName',m.specification as 'materialSpec'
FROM inventory_transaction i
INNER JOIN material m ON i.materialCode = m.code and i.warehouseCode=m.warehouseCode
<if test="id != null ">
AND i.id = #{id}
</if>
<if test="warehouseId != null ">
AND i.warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND i.warehouseCode = #{warehouseCode}
</if>
<if test="locationId != null ">
AND i.locationId = #{locationId}
</if>
<if test="locationCode != null and locationCode != ''">
AND i.locationCode = #{locationCode}
</if>
<if test="containerCode != null and containerCode != ''">
AND i.containerCode = #{containerCode}
</if>
<if test="sourceCode != null and sourceCode != ''">
AND i.sourceCode = #{sourceCode}
</if>
<if test="sourceLine != null and sourceLine != ''">
AND i.sourceLine =#{sourceLine}
</if>
<if test="type != null and type != ''">
<bind name="typePattern" value="'%' + type + '%'" />
AND i.type like #{typePattern}
</if>
<if test="companyId != null ">
AND i.companyId = #{companyId}
</if>
<if test="companyCode != null and companyCode != ''">
AND i.companyCode = #{companyCode}
</if>
<if test="materialId != null ">
AND i.materialId = #{materialId}
</if>
<if test="materialCode != null and materialCode != ''">
AND i.materialCode = #{materialCode}
</if>
<if test="billId != null ">
AND i.billId = #{billId}
</if>
<if test="billCode != null and billCode != ''">
AND i.billCode = #{billCode}
</if>
<if test="billDetailId != null ">
AND i.billDetailId = #{billDetailId}
</if>
<if test="batch != null and batch != ''">
<bind name="batchPattern" value="'%' + batch + '%'" />
AND i.batch like #{batchPattern}
</if>
<if test="lot != null and lot != ''">
<bind name="lotPattern" value="'%' + lot + '%'" />
AND i.lot like #{lotPattern}
</if>
<if test="project != null and project != ''">
<bind name="projectPattern" value="'%' + project + '%'" />
AND i.project like #{projectPattern}
</if>
<if test="params != null and params.manufactureDateBegin != null and params.manufactureDateBegin != ''">
AND i.manufactureDate >= #{params.manufactureDateBegin}
</if>
<if test="params != null and params.manufactureDateEnd != null and params.manufactureDateEnd != ''">
AND i.manufactureDate <= #{params.manufactureDateEnd}
</if>
<if test="params != null and params.expirationDateBegin != null and params.expirationDateBegin != ''">
AND i.expirationDate >= #{params.expirationDateBegin}
</if>
<if test="params != null and params.expirationDateEnd != null and params.expirationDateEnd != ''">
AND i.expirationDate <= #{params.expirationDateEnd}
</if>
<if test="status != null and status != ''">
<bind name="statusPattern" value="'%' + status + '%'" />
AND i.status = #{statusPattern}
</if>
<if test="qty != null ">
AND i.qty = #{qty}
</if>
<if test="taskQty != null ">
AND i.taskQty = #{taskQty}
</if>
<if test="costPrice != null ">
AND i.costPrice = #{costPrice}
</if>
<if test="listPrice != null ">
AND i.listPrice = #{listPrice}
</if>
<if test="netPrice != null ">
AND i.netPrice = #{netPrice}
</if>
<if test="params != null and params.createdBegin != null and params.createdBegin != ''">
AND i.created >= #{params.createdBegin}
</if>
<if test="params != null and params.createdEnd != null and params.createdEnd != ''">
AND i.created <= #{params.createdEnd}
</if>
<if test="createdBy != null and createdBy != ''">
<bind name="createdByPattern" value="'%' + createdBy + '%'" />
AND i.createdBy like #{createdByPattern}
</if>
<if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''">
AND i.lastUpdated >= #{params.lastUpdatedBegin}
</if>
<if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''">
AND i.lastUpdated <= #{params.lastUpdatedEnd}
</if>
<if test="lastUpdatedBy != null and lastUpdatedBy != ''">
<bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" />
AND i.lastUpdatedBy like #{lastUpdatedByPattern}
</if>
<if test="userDef1 != null and userDef1 != ''">
AND i.userDef1 = #{userDef1}
</if>
<if test="userDef2 != null and userDef2 != ''">
AND i.userDef2 = #{userDef2}
</if>
<if test="userDef3 != null and userDef3 != ''">
AND i.userDef3 = #{userDef3}
</if>
<if test="materialName != null and materialName != ''">
<bind name="materialNamePattern" value="'%' + materialName + '%'" />
AND m.name like #{materialNamePattern}
</if>
<if test="materialSpec != null and materialSpec != ''">
<bind name="materialSpecPattern" value="'%' + materialSpec + '%'" />
AND m.specification like #{materialSpecPattern}
</if>
AND m.deleted = 0
</select>
<!--批量新增-->
<insert id="insertBatch" parameterType="com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction" keyProperty="id" useGeneratedKeys="true">
INSERT INTO inventory_transaction(
warehouseId,
warehouseCode,
uWarehouseCode,
zoneCode,
locationId,
locationCode,
containerCode,
sourceCode,
sourceLine,
type,
companyId,
companyCode,
materialId,
materialName,
materialCode,
billId,
billCode,
billDetailId,
batch,
lot,
project,
manufactureDate,
expirationDate,
status,
qty,
taskQty,
costPrice,
listPrice,
netPrice,
created,
createdBy,
lastUpdated,
lastUpdatedBy,
userDef1,
userDef2,
userDef3
)VALUES
<foreach collection="inventoryTransactionList" item="item" index="index" separator=",">
(
#{item.warehouseId,jdbcType=INTEGER},
#{item.warehouseCode,jdbcType=VARCHAR},
#{item.uWarehouseCode,jdbcType=VARCHAR},
#{item.zoneCode,jdbcType=VARCHAR},
#{item.locationId,jdbcType=INTEGER},
#{item.locationCode,jdbcType=VARCHAR},
#{item.containerCode,jdbcType=VARCHAR},
#{item.sourceCode,jdbcType=VARCHAR},
#{item.sourceLine,jdbcType=VARCHAR},
#{item.type,jdbcType=VARCHAR},
#{item.companyId,jdbcType=INTEGER},
#{item.companyCode,jdbcType=VARCHAR},
#{item.materialId,jdbcType=INTEGER},
#{item.materialName,jdbcType=VARCHAR},
#{item.materialCode,jdbcType=VARCHAR},
#{item.billId,jdbcType=INTEGER},
#{item.billCode,jdbcType=VARCHAR},
#{item.billDetailId,jdbcType=INTEGER},
#{item.batch,jdbcType=VARCHAR},
#{item.lot,jdbcType=VARCHAR},
#{item.project,jdbcType=VARCHAR},
#{item.manufactureDate, jdbcType=TIMESTAMP},
#{item.expirationDate, jdbcType=TIMESTAMP},
#{item.status, jdbcType=VARCHAR},
#{item.qty, jdbcType=DECIMAL},
#{item.taskQty, jdbcType=DECIMAL},
#{item.costPrice, jdbcType=DECIMAL},
#{item.listPrice, jdbcType=DECIMAL},
#{item.netPrice, jdbcType=DECIMAL},
#{item.created, jdbcType=TIMESTAMP},
#{item.createdBy, jdbcType=VARCHAR},
#{item.lastUpdated, jdbcType=TIMESTAMP},
#{item.lastUpdatedBy, jdbcType=VARCHAR},
#{item.userDef1, jdbcType=VARCHAR},
#{item.userDef2, jdbcType=VARCHAR},
#{item.userDef3, jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper>