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
<?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.brilliance.isc.mda.dao.CbeMapper">
<resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Cbe">
<result property="inr" column="inr" jdbcType="VARCHAR"/>
<result property="objtyp" column="objtyp" jdbcType="VARCHAR"/>
<result property="objinr" column="objinr" jdbcType="VARCHAR"/>
<result property="extid" column="extid" jdbcType="VARCHAR"/>
<result property="cbt" column="cbt" jdbcType="VARCHAR"/>
<result property="trntyp" column="trntyp" jdbcType="VARCHAR"/>
<result property="trninr" column="trninr" jdbcType="VARCHAR"/>
<result property="dat" column="dat" jdbcType="DATE"/>
<result property="cur" column="cur" jdbcType="VARCHAR"/>
<result property="amt" column="amt" jdbcType="DECIMAL"/>
<result property="relflg" column="relflg" jdbcType="VARCHAR"/>
<result property="credat" column="credat" jdbcType="DATE"/>
<result property="xrfcur" column="xrfcur" jdbcType="VARCHAR"/>
<result property="xrfamt" column="xrfamt" jdbcType="DECIMAL"/>
<result property="nam" column="nam" jdbcType="VARCHAR"/>
<result property="acc" column="acc" jdbcType="VARCHAR"/>
<result property="acc2" column="acc2" jdbcType="VARCHAR"/>
<result property="optdat" column="optdat" jdbcType="DATE"/>
<result property="gledat" column="gledat" jdbcType="DATE"/>
<result property="nompct" column="nompct" jdbcType="DECIMAL"/>
</resultMap>
<sql id="Base_Column_List">
inr,objtyp,objinr,extid,cbt,trntyp,trninr,dat,cur,amt,relflg,credat,xrfcur,xrfamt,nam,acc,acc2,optdat,gledat,nompct
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from cbe
where inr = #{inr,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey">
delete from cbe
where inr = #{inr,jdbcType=VARCHAR}
</delete>
<insert id="insert">
insert into cbe (<include refid="Base_Column_List" />)
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{inr,jdbcType=VARCHAR},
#{objtyp,jdbcType=VARCHAR},
#{objinr,jdbcType=VARCHAR},
#{extid,jdbcType=VARCHAR},
#{cbt,jdbcType=VARCHAR},
#{trntyp,jdbcType=VARCHAR},
#{trninr,jdbcType=VARCHAR},
#{dat,jdbcType=DATE},
#{cur,jdbcType=VARCHAR},
#{amt,jdbcType=DECIMAL},
#{relflg,jdbcType=VARCHAR},
#{credat,jdbcType=DATE},
#{xrfcur,jdbcType=VARCHAR},
#{xrfamt,jdbcType=DECIMAL},
#{nam,jdbcType=VARCHAR},
#{acc,jdbcType=VARCHAR},
#{acc2,jdbcType=VARCHAR},
#{optdat,jdbcType=DATE},
#{gledat,jdbcType=DATE},
#{nompct,jdbcType=DECIMAL},
</trim>
</insert>
<insert id="insertSelective">
insert into cbe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inr != null">inr,</if>
<if test="objtyp != null">objtyp,</if>
<if test="objinr != null">objinr,</if>
<if test="extid != null">extid,</if>
<if test="cbt != null">cbt,</if>
<if test="trntyp != null">trntyp,</if>
<if test="trninr != null">trninr,</if>
<if test="dat != null">dat,</if>
<if test="cur != null">cur,</if>
<if test="amt != null">amt,</if>
<if test="relflg != null">relflg,</if>
<if test="credat != null">credat,</if>
<if test="xrfcur != null">xrfcur,</if>
<if test="xrfamt != null">xrfamt,</if>
<if test="nam != null">nam,</if>
<if test="acc != null">acc,</if>
<if test="acc2 != null">acc2,</if>
<if test="optdat != null">optdat,</if>
<if test="gledat != null">gledat,</if>
<if test="nompct != null">nompct,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
<if test="objtyp != null">#{objtyp,jdbcType=VARCHAR}, </if>
<if test="objinr != null">#{objinr,jdbcType=VARCHAR}, </if>
<if test="extid != null">#{extid,jdbcType=VARCHAR}, </if>
<if test="cbt != null">#{cbt,jdbcType=VARCHAR}, </if>
<if test="trntyp != null">#{trntyp,jdbcType=VARCHAR}, </if>
<if test="trninr != null">#{trninr,jdbcType=VARCHAR}, </if>
<if test="dat != null">#{dat,jdbcType=DATE}, </if>
<if test="cur != null">#{cur,jdbcType=VARCHAR}, </if>
<if test="amt != null">#{amt,jdbcType=DECIMAL}, </if>
<if test="relflg != null">#{relflg,jdbcType=VARCHAR}, </if>
<if test="credat != null">#{credat,jdbcType=DATE}, </if>
<if test="xrfcur != null">#{xrfcur,jdbcType=VARCHAR}, </if>
<if test="xrfamt != null">#{xrfamt,jdbcType=DECIMAL}, </if>
<if test="nam != null">#{nam,jdbcType=VARCHAR}, </if>
<if test="acc != null">#{acc,jdbcType=VARCHAR}, </if>
<if test="acc2 != null">#{acc2,jdbcType=VARCHAR}, </if>
<if test="optdat != null">#{optdat,jdbcType=DATE}, </if>
<if test="gledat != null">#{gledat,jdbcType=DATE}, </if>
<if test="nompct != null">#{nompct,jdbcType=DECIMAL}, </if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update cbe
<set>
<if test="objtyp != null">objtyp = #{objtyp,jdbcType=VARCHAR},</if>
<if test="objinr != null">objinr = #{objinr,jdbcType=VARCHAR},</if>
<if test="extid != null">extid = #{extid,jdbcType=VARCHAR},</if>
<if test="cbt != null">cbt = #{cbt,jdbcType=VARCHAR},</if>
<if test="trntyp != null">trntyp = #{trntyp,jdbcType=VARCHAR},</if>
<if test="trninr != null">trninr = #{trninr,jdbcType=VARCHAR},</if>
<if test="dat != null">dat = #{dat,jdbcType=DATE},</if>
<if test="cur != null">cur = #{cur,jdbcType=VARCHAR},</if>
<if test="amt != null">amt = #{amt,jdbcType=DECIMAL},</if>
<if test="relflg != null">relflg = #{relflg,jdbcType=VARCHAR},</if>
<if test="credat != null">credat = #{credat,jdbcType=DATE},</if>
<if test="xrfcur != null">xrfcur = #{xrfcur,jdbcType=VARCHAR},</if>
<if test="xrfamt != null">xrfamt = #{xrfamt,jdbcType=DECIMAL},</if>
<if test="nam != null">nam = #{nam,jdbcType=VARCHAR},</if>
<if test="acc != null">acc = #{acc,jdbcType=VARCHAR},</if>
<if test="acc2 != null">acc2 = #{acc2,jdbcType=VARCHAR},</if>
<if test="optdat != null">optdat = #{optdat,jdbcType=DATE},</if>
<if test="gledat != null">gledat = #{gledat,jdbcType=DATE},</if>
<if test="nompct != null">nompct = #{nompct,jdbcType=DECIMAL},</if>
</set>
where inr = #{inr,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey">
update cbe
<set>
objtyp = #{objtyp,jdbcType=VARCHAR},
objinr = #{objinr,jdbcType=VARCHAR},
extid = #{extid,jdbcType=VARCHAR},
cbt = #{cbt,jdbcType=VARCHAR},
trntyp = #{trntyp,jdbcType=VARCHAR},
trninr = #{trninr,jdbcType=VARCHAR},
dat = #{dat,jdbcType=DATE},
cur = #{cur,jdbcType=VARCHAR},
amt = #{amt,jdbcType=DECIMAL},
relflg = #{relflg,jdbcType=VARCHAR},
credat = #{credat,jdbcType=DATE},
xrfcur = #{xrfcur,jdbcType=VARCHAR},
xrfamt = #{xrfamt,jdbcType=DECIMAL},
nam = #{nam,jdbcType=VARCHAR},
acc = #{acc,jdbcType=VARCHAR},
acc2 = #{acc2,jdbcType=VARCHAR},
optdat = #{optdat,jdbcType=DATE},
gledat = #{gledat,jdbcType=DATE},
nompct = #{nompct,jdbcType=DECIMAL},
</set>
where inr = #{inr,jdbcType=VARCHAR}
</update>
<delete id="deleteByIds">
delete from act where inr in
<foreach item="item" index="index" collection="collection" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<update id="dyncUpdate">
update cbe
<set>
<if test="module.objtyp != null">objtyp = #{module.objtyp,jdbcType=VARCHAR},</if>
<if test="module.objinr != null">objinr = #{module.objinr,jdbcType=VARCHAR},</if>
<if test="module.extid != null">extid = #{module.extid,jdbcType=VARCHAR},</if>
<if test="module.cbt != null">cbt = #{module.cbt,jdbcType=VARCHAR},</if>
<if test="module.trntyp != null">trntyp = #{module.trntyp,jdbcType=VARCHAR},</if>
<if test="module.trninr != null">trninr = #{module.trninr,jdbcType=VARCHAR},</if>
<if test="module.dat != null">dat = #{module.dat,jdbcType=DATE},</if>
<if test="module.cur != null">cur = #{module.cur,jdbcType=VARCHAR},</if>
<if test="module.amt != null">amt = #{module.amt,jdbcType=DECIMAL},</if>
<if test="module.relflg != null">relflg = #{module.relflg,jdbcType=VARCHAR},</if>
<if test="module.credat != null">credat = #{module.credat,jdbcType=DATE},</if>
<if test="module.xrfcur != null">xrfcur = #{module.xrfcur,jdbcType=VARCHAR},</if>
<if test="module.xrfamt != null">xrfamt = #{module.xrfamt,jdbcType=DECIMAL},</if>
<if test="module.nam != null">nam = #{module.nam,jdbcType=VARCHAR},</if>
<if test="module.acc != null">acc = #{module.acc,jdbcType=VARCHAR},</if>
<if test="module.acc2 != null">acc2 = #{module.acc2,jdbcType=VARCHAR},</if>
<if test="module.optdat != null">optdat = #{module.optdat,jdbcType=DATE},</if>
<if test="module.gledat != null">gledat = #{module.gledat,jdbcType=DATE},</if>
<if test="module.nompct != null">nompct = #{module.nompct,jdbcType=DECIMAL},</if>
</set>
${conditions}
</update>
<delete id="dyncDelete">
${sql}
</delete>
<select id="dyncRead" resultMap="BaseResultMap">
${sql}
</select>
<select id="getCbeListByTrnTypeAndInr" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from cbe
where trntyp =#{trntyp} and trninr =#{trninr}
</select>
<select id="getCbeListByTrnTypeAndInrWithEFlag" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from cbe
where trntyp =#{trntyp} and trninr =#{trninr} and relflg='E' order by length(inr) ASC, inr ASC
</select>
<select id="getCbeListByObjTypAndInrWithCbt" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from cbe
where objinr =#{objinr} and objtyp =#{objtyp} and cbt =#{cbt}
</select>
<select id="getCurListByAccInCcv" resultType="java.lang.String">
select distinct(cur) from cbe
where objinr =#{objinr} and objtyp =#{objtyp} and acc=#{acc} and cbt ='CCVIN'
</select>
<select id="queryCbe" resultType="com.brilliance.isc.bo.Cbe">
select
<include refid="Base_Column_List"/>
from cbe
where (cbe.objtyp = #{objtyp}
and cbe.objinr = #{objinr})
<if test="pteList != null and pteList.size() >0 ">
or (objtyp = 'PTE' and
objinr in
<foreach item="pte" collection="pteList" open="(" separator="," close=")">#{pte.inr}
</foreach>
)
</if>
order by trninr
</select>
<select id="getCbeListByObjTypeAndInr" resultType="com.brilliance.isc.bo.Cbe">
select
<include refid="Base_Column_List"/>
from cbe
where objtyp = #{objtyp}
and objinr = #{objinr}
order by DAT asc
</select>
<select id="getSumamtByObjtypObjinrAccCur" resultType="BigDecimal">
select
sum(amt)
from
cbe
where
relflg = 'R'
and cbt = 'CCVOUT'
and acc = #{acc}
and cur = #{cur}
and objtyp = #{objtyp}
and objinr = #{objinr}
</select>
<select id="getSumamtByObjtypObjinr" resultType="com.brilliance.isc.vo.lg.CbeVo">
select
sum(amt) sumamt,
cur
from
cbe
where
relflg = 'R'
and cbt = 'MAXAMT'
and EXTID = 'AMT1'
and objtyp = #{objtyp}
and objinr = #{objinr}
group by
cur
</select>
<select id="getSumamtByObjtypinrAndCbt" resultType="com.brilliance.isc.vo.lg.CbeVo">
select
sum(amt) sumamt,
cur
from
cbe
where
relflg = 'R'
and cbt = #{cbt}
and EXTID = 'AMT1'
and objtyp = #{objtyp}
and objinr = #{objinr}
group by
cur
</select>
<select id="selectByObjtypAndObjinrAndCbtAndTrninr" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from cbe
where
objtyp = #{objtyp,jdbcType=VARCHAR}
AND objinr = #{objinr,jdbcType=VARCHAR}
AND cbt = #{cbt,jdbcType=VARCHAR}
AND trninr = #{trninr,jdbcType=VARCHAR}
</select>
<select id="selectCecmCbe" resultMap="BaseResultMap">
SELECT cur, sum(amt) as amt FROM cbe
WHERE objtyp = #{objtyp,jdbcType=VARCHAR}
AND objinr = #{objinr,jdbcType=VARCHAR}
AND trninr = #{trninr,jdbcType=VARCHAR}
AND cbt = #{cbt,jdbcType=VARCHAR}
AND extid in
<foreach collection="list" item="items" open="(" separator="," close=")">
#{items}
</foreach>
</select>
<select id="selectPayamt" resultMap="BaseResultMap">
select sum(amt) as amt from cbe
where
objtyp = 'PTE' and
objinr in (select inr from pte where objtyp = 'PTS' and objinr = #{objinr, jdbcType=VARCHAR} and cbtpfx = #{cbtpfx}) and cbt = 'LIAOUT'
</select>
<select id="reportForSet" resultType="com.brilliance.isc.vo.report.ReportForUdpSetVo">
SELECT
trn.objinr inr,
CBE.CREDAT,
CBE.CUR,
CBE.AMT
FROM
cbe
LEFT JOIN trn ON cbe.TRNINR = trn.inr
WHERE
cbe.objtyp = 'PTE'
AND cbe.cbt = 'LIAOUT'
AND trn.objtyp = 'BRD'
AND (trn.INIFRM = 'BRTSET' OR trn.INIFRM = 'BRTSUS')
AND trn.RELFLG IN ('R','F')
AND trn.OBJINR IN
<foreach item="inr" collection="inrs" open="(" separator="," close=")">
#{inr}
</foreach>
GROUP BY trn.objinr
</select>
<select id="getCcvCbeList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from cbe
where objinr =#{objinr} and objtyp =#{objtyp} and cbt in ('CCVIN', 'CCVOUT')
order by dat,inr desc
</select>
</mapper>