ept_entry_bodyMapper.xml
11.3 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
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<?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.eport.rest.dao.EptEntryBodyDao">
<sql id="EptEntryBodyEntityColumns">
a1.ID AS "id"
,a1.BOOK_ID AS "bookId"
,a1.HEAD_ID AS "headId"
,a1.ENTRY_ID AS "entryId"
,a1.G_NO AS "gNo"
,a1.CODE_TS AS "codeTs"
,a1.G_NAME AS "gName"
,a1.G_MODEL AS "gModel"
,a1.ORIGIN_COUNTRY AS "originCountry"
,a1.CONTR_ITEM AS "contrItem"
,a1.TRADE_CURR AS "tradeCurr"
,a1.EXCHANGE_RATE AS "exchangeRate"
,a1.DECL_PRICE AS "declPrice"
,a1.DECL_TOTAL AS "declTotal"
,a1.USE_TO AS "useTo"
,a1.DUTY_MODE AS "dutyMode"
,a1.G_QTY AS "gQty"
,a1.G_UNIT AS "gUnit"
,a1.QTY_1 AS "qty1"
,a1.UNIT_1 AS "unit1"
,a1.QTY_2 AS "qty2"
,a1.UNIT_2 AS "unit2"
,a1.TRADE_TOTAL AS "tradeTotal"
,a1.DUTY_VALUE AS "dutyValue"
,a1.G_PROCESS_MARK AS "gProcessMark"
,a1.WORK_USD AS "workUsd"
,a1.IS_DELETE AS "isDelete"
,a1.CREATE_ID AS "createId"
,a1.COP_G_NO AS "copGNo"
,a1.CREATE_DATE AS "createDate"
,a1.G_NO2 AS "gNo2"
,a1.UPDATE_ID AS "updateId"
,a1.UPDATE_DATE AS "updateDate"
,a1.STORE_BILL_NO AS "storeBillNo"
,a1.TIN_GUID AS "tinGuid"
,a1.ECI_GOODS_FLAG AS "eciGoodsFlag"
,a1.FACTOR_1 AS "factor1"
,a1.FACTOR_2 AS "factor2"
,a1.DESTINATIONCOUNTRY AS "destinationcountry"
,a1.REMARK AS "remark"
</sql>
<sql id="EptEntryBodyEntityListColumns">
a1.ID AS "id"
</sql>
<!--查询表中所有资料(所有字段) -->
<select id="listAll"
parameterType="HashMap"
resultType="com.eport.rest.entity.EptEntryBodyEntity"
>
select
<include refid="EptEntryBodyEntityColumns"/>
,(select COUNTRY_NA from country c1 where c1.COUNTRY_CO = a1.ORIGIN_COUNTRY) as originCountryName
,(select CURR_NAME from curr c1 where c1.CURR_CODE = a1.TRADE_CURR) as tradeCurrName
,(select DUTY_SPEC from levymode c1 where c1.DUTY_MODE = a1.DUTY_MODE) as dutyModeName
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_1) as unit1Name
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_2) as unit2Name
,(select PAR_NAME from ept_parameter c1 where c1.PAR_CODE = a1.ECI_GOODS_FLAG) as eciGoodsFlagName
FROM ept_entry_body a1
WHERE 1=1
</select>
<!--分页查询资料(所有字段) -->
<select id="pageAll"
parameterType="HashMap"
resultType="com.eport.rest.entity.EptEntryBodyEntity"
>
select
<include refid="EptEntryBodyEntityColumns"/>
,(select COUNTRY_NA from country c1 where c1.COUNTRY_CO = a1.ORIGIN_COUNTRY) as originCountryName
,(select CURR_NAME from curr c1 where c1.CURR_CODE = a1.TRADE_CURR) as tradeCurrName
,(select DUTY_SPEC from levymode c1 where c1.DUTY_MODE = a1.DUTY_MODE) as dutyModeName
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_1) as unit1Name
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_2) as unit2Name
,(select PAR_NAME from ept_parameter c1 where c1.PAR_CODE = a1.ECI_GOODS_FLAG) as eciGoodsFlagName
FROM ept_entry_body a1
WHERE 1=1
</select>
<!--查询表中所有资料(仅列表显示字段) -->
<select id="list"
parameterType="HashMap"
resultType="com.eport.rest.entity.EptEntryBodyEntity"
>
select
<include refid="EptEntryBodyEntityListColumns"/>
FROM ept_entry_body a1
WHERE 1=1
</select>
<!--分页查询资料(仅列表显示字段) -->
<select id="page"
parameterType="HashMap"
resultType="com.eport.rest.entity.EptEntryBodyEntity"
>
select
<include refid="EptEntryBodyEntityListColumns"/>
FROM ept_entry_body a1
WHERE 1=1
</select>
<!--根据主键查询数据 -->
<select id="findByPK"
parameterType="Integer"
resultType="com.eport.rest.entity.EptEntryBodyEntity"
>
select
<include refid="EptEntryBodyEntityColumns"/>
,(select COUNTRY_NA from country c1 where c1.COUNTRY_CO = a1.ORIGIN_COUNTRY) as originCountryName
,(select CURR_NAME from curr c1 where c1.CURR_CODE = a1.TRADE_CURR) as tradeCurrName
,(select DUTY_SPEC from levymode c1 where c1.DUTY_MODE = a1.DUTY_MODE) as dutyModeName
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_1) as unit1Name
,(select UNIT_NAME from unit c1 where c1.UNIT_CODE = a1.UNIT_2) as unit2Name
,(select PAR_NAME from ept_parameter c1 where c1.PAR_CODE = a1.ECI_GOODS_FLAG) as eciGoodsFlagName
FROM ept_entry_body a1
WHERE a1.ID=#{par}
</select>
<!--新增数据 -->
<insert id="insert"
parameterType="com.eport.rest.entity.EptEntryBodyEntity"
>
<selectKey resultType="Integer" order="AFTER" keyProperty="id">
<if test="id != null ">
select #{id} from dual
</if>
<if test="id == null ">
SELECT LAST_INSERT_ID() AS id
</if>
</selectKey>
insert
INTO ept_entry_body (
BOOK_ID
,HEAD_ID
,ENTRY_ID
,G_NO
,CODE_TS
,G_NAME
,G_MODEL
,ORIGIN_COUNTRY
,CONTR_ITEM
,TRADE_CURR
,EXCHANGE_RATE
,DECL_PRICE
,DECL_TOTAL
,USE_TO
,DUTY_MODE
,G_QTY
,G_UNIT
,QTY_1
,UNIT_1
,QTY_2
,UNIT_2
,TRADE_TOTAL
,DUTY_VALUE
,G_PROCESS_MARK
,WORK_USD
,IS_DELETE
,CREATE_ID
,COP_G_NO
,CREATE_DATE
,G_NO2
,UPDATE_ID
,UPDATE_DATE
,STORE_BILL_NO
,TIN_GUID
,ECI_GOODS_FLAG
,FACTOR_1
,FACTOR_2
,DESTINATIONCOUNTRY
,REMARK
<if test="id != null ">
,ID
</if>
) VALUES (
#{bookId,jdbcType=INTEGER}
,#{headId,jdbcType=INTEGER}
,#{entryId,jdbcType=VARCHAR}
,#{gNo,jdbcType=INTEGER}
,#{codeTs,jdbcType=VARCHAR}
,#{gName,jdbcType=VARCHAR}
,#{gModel,jdbcType=VARCHAR}
,#{originCountry,jdbcType=VARCHAR}
,#{contrItem,jdbcType=INTEGER}
,#{tradeCurr,jdbcType=VARCHAR}
,#{exchangeRate,jdbcType=FLOAT}
,#{declPrice,jdbcType=FLOAT}
,#{declTotal,jdbcType=FLOAT}
,#{useTo,jdbcType=VARCHAR}
,#{dutyMode,jdbcType=VARCHAR}
,#{gQty,jdbcType=FLOAT}
,#{gUnit,jdbcType=VARCHAR}
,#{qty1,jdbcType=FLOAT}
,#{unit1,jdbcType=VARCHAR}
,#{qty2,jdbcType=FLOAT}
,#{unit2,jdbcType=VARCHAR}
,#{tradeTotal,jdbcType=FLOAT}
,#{dutyValue,jdbcType=FLOAT}
,#{gProcessMark,jdbcType=VARCHAR}
,#{workUsd,jdbcType=FLOAT}
,#{isDelete,jdbcType=INTEGER}
,#{createId,jdbcType=INTEGER}
,#{copGNo,jdbcType=VARCHAR}
,#{createDate,jdbcType=DATE}
,#{gNo2,jdbcType=INTEGER}
,#{updateId,jdbcType=INTEGER}
,#{updateDate,jdbcType=DATE}
,#{storeBillNo,jdbcType=VARCHAR}
,#{tinGuid,jdbcType=VARCHAR}
,#{eciGoodsFlag,jdbcType=VARCHAR}
,#{factor1,jdbcType=FLOAT}
,#{factor2,jdbcType=FLOAT}
,#{destinationcountry,jdbcType=VARCHAR}
,#{remark,jdbcType=VARCHAR}
<if test="id != null ">
,#{id,jdbcType=INTEGER}
</if>
)
</insert>
<!--更新数据 -->
<update id="update"
parameterType="com.eport.rest.entity.EptEntryBodyEntity"
>
update
ept_entry_body
<set>
<if test="bookId != null ">
BOOK_ID = #{bookId},
</if>
<if test="headId != null ">
HEAD_ID = #{headId},
</if>
<if test="entryId != null ">
ENTRY_ID = #{entryId},
</if>
<if test="gNo != null ">
G_NO = #{gNo},
</if>
<if test="codeTs != null ">
CODE_TS = #{codeTs},
</if>
<if test="gName != null ">
G_NAME = #{gName},
</if>
<if test="gModel != null ">
G_MODEL = #{gModel},
</if>
<if test="originCountry != null ">
ORIGIN_COUNTRY = #{originCountry},
</if>
<if test="contrItem != null ">
CONTR_ITEM = #{contrItem},
</if>
<if test="tradeCurr != null ">
TRADE_CURR = #{tradeCurr},
</if>
<if test="exchangeRate != null ">
EXCHANGE_RATE = #{exchangeRate},
</if>
<if test="declPrice != null ">
DECL_PRICE = #{declPrice},
</if>
<if test="declTotal != null ">
DECL_TOTAL = #{declTotal},
</if>
<if test="useTo != null ">
USE_TO = #{useTo},
</if>
<if test="dutyMode != null ">
DUTY_MODE = #{dutyMode},
</if>
<if test="gQty != null ">
G_QTY = #{gQty},
</if>
<if test="gUnit != null ">
G_UNIT = #{gUnit},
</if>
<if test="qty1 != null ">
QTY_1 = #{qty1},
</if>
<if test="unit1 != null ">
UNIT_1 = #{unit1},
</if>
<if test="qty2 != null ">
QTY_2 = #{qty2},
</if>
<if test="unit2 != null ">
UNIT_2 = #{unit2},
</if>
<if test="tradeTotal != null ">
TRADE_TOTAL = #{tradeTotal},
</if>
<if test="dutyValue != null ">
DUTY_VALUE = #{dutyValue},
</if>
<if test="gProcessMark != null ">
G_PROCESS_MARK = #{gProcessMark},
</if>
<if test="workUsd != null ">
WORK_USD = #{workUsd},
</if>
<if test="isDelete != null ">
IS_DELETE = #{isDelete},
</if>
<if test="createId != null ">
CREATE_ID = #{createId},
</if>
<if test="copGNo != null ">
COP_G_NO = #{copGNo},
</if>
<if test="createDate != null ">
CREATE_DATE = #{createDate},
</if>
<if test="gNo2 != null ">
G_NO2 = #{gNo2},
</if>
<if test="updateId != null ">
UPDATE_ID = #{updateId},
</if>
<if test="updateDate != null ">
UPDATE_DATE = #{updateDate},
</if>
<if test="storeBillNo != null ">
STORE_BILL_NO = #{storeBillNo},
</if>
<if test="tinGuid != null ">
TIN_GUID = #{tinGuid},
</if>
<if test="eciGoodsFlag != null ">
ECI_GOODS_FLAG = #{eciGoodsFlag},
</if>
<if test="factor1 != null ">
FACTOR_1 = #{factor1},
</if>
<if test="factor2 != null ">
FACTOR_2 = #{factor2},
</if>
<if test="destinationcountry != null ">
DESTINATIONCOUNTRY = #{destinationcountry},
</if>
<if test="remark != null ">
REMARK = #{remark},
</if>
</set>
WHERE ID = #{id}
</update>
<!--根据主键删除数据 -->
<delete id="delete"
parameterType="HashMap"
>
delete
from ept_entry_body
WHERE ID in (${par})
</delete>
<!--根据表头ID查询资料 -->
<select id="findByHeadId"
parameterType="HashMap"
resultType="HashMap"
>
SELECT
a1.ID AS "id",
a1.BOOK_ID AS "bookId",
a1.HEAD_ID AS "headId",
a1.ENTRY_ID AS "entryId",
a1.G_NO AS "gNo",
a1.CODE_TS AS "codeTs",
a1.G_NAME AS "gName",
a1.G_MODEL AS "gModel",
a1.ORIGIN_COUNTRY AS "originCountry",
a1.CONTR_ITEM AS "contrItem",
a1.TRADE_CURR AS "tradeCurr",
a1.EXCHANGE_RATE AS "exchangeRate",
a1.DECL_PRICE AS "declPrice",
a1.DECL_TOTAL AS "declTotal",
a1.USE_TO AS "useTo",
a1.DUTY_MODE AS "dutyMode",
a1.G_QTY AS "gQty",
a1.G_UNIT AS "gUnit",
a1.QTY_1 AS "qty1",
a1.UNIT_1 AS "unit1",
a1.QTY_2 AS "qty2",
a1.UNIT_2 AS "unit2",
a1.TRADE_TOTAL AS "tradeTotal",
a1.DUTY_VALUE AS "dutyValue",
a1.G_PROCESS_MARK AS "gProcessMark",
a1.WORK_USD AS "workUsd",
a1.COP_G_NO AS "copGNo",
a1.G_NO2 AS "gNo2",
a1.IS_DELETE AS "isDelete",
a1.CREATE_ID AS "createId",
a1.CREATE_DATE AS "createDate",
a1.UPDATE_ID AS "updateId",
a1.UPDATE_DATE AS "updateDate"
,a1.STORE_BILL_NO AS "storeBillNo"
,a1.TIN_GUID AS "tinGuid"
,a1.ECI_GOODS_FLAG AS "eciGoodsFlag"
,a1.FACTOR_1 AS "factor1"
,a1.FACTOR_2 AS "factor2"
,a1.DESTINATIONCOUNTRY AS "destinationcountry"
,a1.REMARK AS "remark",
(
SELECT
COUNTRY_NA
FROM
country c1
WHERE
c1.COUNTRY_CO = a1.ORIGIN_COUNTRY
) AS "originCountryName",
(select COUNTRY_NA from country c1 where c1.COUNTRY_CO = a1.DESTINATIONCOUNTRY) as "destinationcountryName"
,(
SELECT
CURR_NAME
FROM
curr c1
WHERE
c1.CURR_CODE = a1.TRADE_CURR
) AS tradeCurrName,
(
SELECT
DUTY_SPEC
FROM
levymode c1
WHERE
c1.DUTY_MODE = a1.DUTY_MODE
) AS dutyModeName,
(
SELECT
UNIT_NAME
FROM
unit c1
WHERE
c1.UNIT_CODE = a1.UNIT_1
) AS unit1Name,
(
SELECT
UNIT_NAME
FROM
unit c1
WHERE
c1.UNIT_CODE = a1.UNIT_2
) AS unit2Name
FROM
ept_entry_body a1
WHERE
a1.HEAD_ID=#{headId}
</select>
</mapper>