CreditAdministrationMapper.xml
16.8 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
<?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.credit.cy.business.mapper.CreditAdministrationMapper">
<resultMap type="com.credit.cy.business.domain.CreditAdministration" id="CreditAdministrationResult">
<result property="id" column="id" />
<result property="catalogId" column="catalog_id" />
<result property="catalogName" column="catalog_name" />
<result property="administrationType" column="administration_type" />
<result property="counterpartName" column="counterpart_name" />
<result property="counterpartType" column="counterpart_type" />
<result property="counterpartCreditCode" column="counterpart_credit_code" />
<result property="delegate" column="delegate" />
<result property="delegateCardType" column="delegate_card_type" />
<result property="delegateCardCode" column="delegate_card_code" />
<result property="counterpartCardCode" column="counterpart_card_code" />
<result property="content" column="content" />
<result property="execTime" column="exec_time" />
<result property="execOrg" column="exec_org" />
<result property="execOrgCode" column="exec_org_code" />
<result property="dataSource" column="data_source" />
<result property="sourceCreditCode" column="source_credit_code" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="reportDept" column="report_dept"/>
<result property="reportDate" column="report_date"/>
<result property="checkStatus" column="check_status"/>
<result property="mdKey" column="md_key"/>
<result property="entityId" column="entity_id"/>
<result property="checkMsg" column="check_msg" />
</resultMap>
<resultMap id="CreditHomeAdministration" type="com.credit.cy.business.service.bo.HomeAdministrationBo">
<result property="adminType" column="admin_type" />
<result property="reportNum" column="report_num"/>
</resultMap>
<sql id="selectCreditAdministrationVo">
select id, catalog_id, administration_type, counterpart_name, counterpart_type, counterpart_credit_code, delegate, delegate_card_type, delegate_card_code, counterpart_card_code, content, exec_time, exec_org, exec_org_code, data_source, source_credit_code, remark,
create_time, update_time, create_by, update_by, report_dept,report_date,check_status,md_key,entity_id,check_msg from credit_administration
</sql>
<select id="selectCreditAdministrationList" parameterType="com.credit.cy.business.domain.CreditAdministration" resultMap="CreditAdministrationResult">
<include refid="selectCreditAdministrationVo"/>
<where>
<if test="counterpartCreditCode != null and counterpartCreditCode != ''"> and counterpart_credit_code = #{counterpartCreditCode}</if>
<if test="delegateCardCode != null and delegateCardCode != ''"> and delegate_card_code = #{delegateCardCode}</if>
<if test="counterpartCardCode != null and counterpartCardCode != ''"> and counterpart_card_code = #{counterpartCardCode}</if>
<if test="catalogId != null "> and catalog_id = #{catalogId}</if>
<if test="createBy != null "> and create_by = #{createBy}</if>
<if test="reportDept != null "> and report_dept =#{reportDept}</if>
<if test="counterpartName != null and counterpartName != ''"> and counterpart_name like concat('%', #{counterpartName}, '%')</if>
<if test="entityId != null "> and entity_id =#{entityId}</if>
<if test="counterpartType != null and counterpartType != ''"> and counterpart_type = #{counterpartType}</if>
<if test="delegate != null and delegate != ''"> and delegate = #{delegate}</if>
<if test="delegateCardType != null and delegateCardType != ''"> and delegate_card_type = #{delegateCardType}</if>
<if test="execTime != null "> and exec_time = #{execTime}</if>
<if test="execOrg != null and execOrg != ''"> and exec_org = #{execOrg}</if>
<if test="execOrgCode != null and execOrgCode != ''"> and exec_org_code = #{execOrgCode}</if>
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource}</if>
<if test="sourceCreditCode != null and sourceCreditCode != ''"> and source_credit_code = #{sourceCreditCode}</if>
<if test="administrationType != null and administrationType != ''"> and administration_type = #{administrationType}</if>
<if test="checkStatus != null "> and check_status =#{checkStatus}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="getCreditAdministrationExport" parameterType="com.credit.cy.business.domain.CreditAdministration" resultMap="CreditAdministrationResult">
SELECT
a.id,
a.catalog_id,
a.administration_type,
a.counterpart_name,
a.counterpart_type,
a.counterpart_credit_code,
a.delegate,
a.delegate_card_type,
a.delegate_card_code,
a.counterpart_card_code,
a.content,
a.exec_time,
a.exec_org,
a.exec_org_code,
a.data_source,
a.source_credit_code,
a.remark,
a.create_time,
a.update_time,
a.create_by,
a.update_by,
a.report_dept,
a.report_date,
a.check_status,
a.md_key,
a.entity_id,
a.check_msg,
c.catalog_name
FROM
credit_administration a
JOIN credit_catalog c ON a.catalog_id = c.id
<where>
<if test="administrationType != null and administrationType != ''"> and a.administration_type = #{administrationType}</if>
<if test="counterpartType != null and counterpartType != ''"> and a.counterpart_type = #{counterpartType}</if>
<if test="counterpartName != null and counterpartName != ''"> and a.counterpart_name like concat('%',#{counterpartName}, '%')</if>
<if test="reportDept != null "> and a.report_dept =#{reportDept}</if>
</where>
</select>
<select id="selectCreditAdministrationById" parameterType="Long" resultMap="CreditAdministrationResult">
<include refid="selectCreditAdministrationVo"/>
where id = #{id}
</select>
<select id="selectCreditAdministrationByMdKey"
resultMap="CreditAdministrationResult">
<include refid="selectCreditAdministrationVo"/>
where md_key = #{mdKey}
</select>
<select id="selectCreditAdministrationListByIds" resultMap="CreditAdministrationResult">
<include refid="selectCreditAdministrationVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertCreditAdministration" parameterType="com.credit.cy.business.domain.CreditAdministration" useGeneratedKeys="true" keyProperty="id">
insert into credit_administration
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="catalogId != null">catalog_id,</if>
<if test="administrationType != null">administration_type,</if>
<if test="counterpartName != null">counterpart_name,</if>
<if test="counterpartType != null">counterpart_type,</if>
<if test="counterpartCreditCode != null">counterpart_credit_code,</if>
<if test="delegate != null">delegate,</if>
<if test="delegateCardType != null">delegate_card_type,</if>
<if test="delegateCardCode != null">delegate_card_code,</if>
<if test="counterpartCardCode != null">counterpart_card_code,</if>
<if test="content != null">content,</if>
<if test="execTime != null">exec_time,</if>
<if test="execOrg != null">exec_org,</if>
<if test="execOrgCode != null">exec_org_code,</if>
<if test="dataSource != null">data_source,</if>
<if test="sourceCreditCode != null">source_credit_code,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="reportDept != null">report_dept,</if>
<if test="reportDate != null">report_date,</if>
<if test="checkStatus != null">check_status,</if>
<if test="mdKey != null">md_key,</if>
<if test="entityId != null">entity_id,</if>
<if test="checkMsg != null">check_msg,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="catalogId != null">#{catalogId},</if>
<if test="administrationType != null">#{administrationType},</if>
<if test="counterpartName != null">#{counterpartName},</if>
<if test="counterpartType != null">#{counterpartType},</if>
<if test="counterpartCreditCode != null">#{counterpartCreditCode},</if>
<if test="delegate != null">#{delegate},</if>
<if test="delegateCardType != null">#{delegateCardType},</if>
<if test="delegateCardCode != null">#{delegateCardCode},</if>
<if test="counterpartCardCode != null">#{counterpartCardCode},</if>
<if test="content != null">#{content},</if>
<if test="execTime != null">#{execTime},</if>
<if test="execOrg != null">#{execOrg},</if>
<if test="execOrgCode != null">#{execOrgCode},</if>
<if test="dataSource != null">#{dataSource},</if>
<if test="sourceCreditCode != null">#{sourceCreditCode},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="reportDept != null">#{reportDept},</if>
<if test="reportDate != null">#{reportDate},</if>
<if test="checkStatus != null">#{checkStatus},</if>
<if test="mdKey != null">#{mdKey},</if>
<if test="entityId != null">#{entityId},</if>
<if test="checkMsg != null">#{checkMsg},</if>
</trim>
</insert>
<update id="updateCreditAdministration" parameterType="com.credit.cy.business.domain.CreditAdministration">
update credit_administration
<trim prefix="SET" suffixOverrides=",">
<if test="counterpartName != null">counterpart_name = #{counterpartName},</if>
<if test="counterpartType != null">counterpart_type = #{counterpartType},</if>
<if test="counterpartCreditCode != null">counterpart_credit_code = #{counterpartCreditCode},</if>
<if test="delegate != null">delegate = #{delegate},</if>
<if test="delegateCardType != null">delegate_card_type = #{delegateCardType},</if>
<if test="delegateCardCode != null">delegate_card_code = #{delegateCardCode},</if>
<if test="counterpartCardCode != null">counterpart_card_code = #{counterpartCardCode},</if>
<if test="content != null">content = #{content},</if>
exec_time = #{execTime},
<if test="execOrg != null">exec_org = #{execOrg},</if>
<if test="execOrgCode != null">exec_org_code = #{execOrgCode},</if>
<if test="dataSource != null">data_source = #{dataSource},</if>
<if test="sourceCreditCode != null">source_credit_code = #{sourceCreditCode},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="checkStatus != null">check_status=#{checkStatus},</if>
<if test="reportDate != null">report_date=#{reportDate},</if>
<if test="reportDept != null">report_dept=#{reportDept},</if>
<if test="mdKey != null">md_key = #{mdKey},</if>
<if test="entityId != null">entity_id = #{entityId},</if>
<if test="checkMsg != null">check_msg = #{checkMsg},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCreditAdministrationById" parameterType="Long">
delete from credit_administration where id = #{id}
</delete>
<delete id="deleteCreditAdministrationByIds" parameterType="String">
delete from credit_administration where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
select count(1) from credit_administration
<where>
<if test="reportDept != null and reportDept != ''"> and report_dept = #{reportDept}</if>
<if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
<if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
</where>
</select>
<select id="selectAdministrationListByQuery" parameterType="com.credit.cy.business.model.query.CreditAdministrationQuery" resultMap="CreditAdministrationResult">
<include refid="selectCreditAdministrationVo"/>
<where>
<if test="catalogId != null "> and catalog_id = #{catalogId}</if>
<if test="createBy != null "> and create_by = #{createBy}</if>
<if test="reportDept != null "> and report_dept =#{reportDept}</if>
<if test="counterpartName != null and counterpartName != ''"> and counterpart_name like concat('%',#{counterpartName}, '%')</if>
<if test="counterpartCardCode != null and counterpartCardCode != ''"> and counterpart_card_code = #{counterpartCardCode}</if>
<if test="counterpartCreditCode != null and counterpartCreditCode != ''"> and counterpart_credit_code = #{counterpartCreditCode}</if>
<if test="entityId != null "> and entity_id = #{entityId}</if>
<if test="counterpartType != null and counterpartType != ''"> and counterpart_type = #{counterpartType}</if>
<if test="administrationType != null and administrationType != ''"> and administration_type = #{administrationType}</if>
<if test="checkStatus != null "> and check_status =#{checkStatus}</if>
<if test="checkStatusList != null "> and check_status in
<foreach item="checkStatus" collection="checkStatusList" open="(" separator="," close=")">
#{checkStatus}
</foreach>
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="homeStatistics" parameterType="com.credit.cy.business.model.query.AdministrationStatisticsQuery" resultMap="CreditHomeAdministration">
select administration_type as admin_type, count(0) as report_num from credit_administration
where check_status = #{checkStatus} and report_date >= #{reportStartDate} and report_date < #{reportEndDate}
<if test="reportDept != null and reportDept != ''"> and report_dept = #{reportDept}</if>
group by admin_type
</select>
</mapper>