CreditMonitorDxtgMapper.xml
10.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
<?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.CreditMonitorDxtgMapper">
<resultMap type="CreditMonitorDxtg" id="CreditMonitorDxtgResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="dxtgType1" column="dxtg_type1" />
<result property="dxtgType1No" column="dxtg_type1_no" />
<result property="dxtgType2" column="dxtg_type2" />
<result property="dxtgType2No" column="dxtg_type2_no" />
<result property="dxtgType3" column="dxtg_type3" />
<result property="dxtgType3No" column="dxtg_type3_no" />
<result property="dxtgType4" column="dxtg_type4" />
<result property="dxtgType4No" column="dxtg_type4_no" />
<result property="dxtgType5" column="dxtg_type5" />
<result property="dxtgType5No" column="dxtg_type5_no" />
<result property="reportDate" column="report_date" />
<result property="reportDept" column="report_dept" />
<result property="checkStatus" column="check_status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectCreditMonitorDxtgVo">
select id, parent_id, dxtg_type1, dxtg_type1_no, dxtg_type2, dxtg_type2_no, dxtg_type3, dxtg_type3_no, dxtg_type4, dxtg_type4_no, dxtg_type5, dxtg_type5_no, report_date, report_dept, check_status, create_by, create_time, del_flag from credit_monitor_dxtg
</sql>
<select id="selectCreditMonitorDxtgList" parameterType="CreditMonitorDxtg" resultMap="CreditMonitorDxtgResult">
<include refid="selectCreditMonitorDxtgVo"/>
<where>
and parent_id = #{parentId}
<if test="dxtgType1 != null and dxtgType1 != ''"> and dxtg_type1 = #{dxtgType1}</if>
<if test="dxtgType1No != null and dxtgType1No != ''"> and dxtg_type1_no = #{dxtgType1No}</if>
<if test="dxtgType2 != null and dxtgType2 != ''"> and dxtg_type2 = #{dxtgType2}</if>
<if test="dxtgType2No != null and dxtgType2No != ''"> and dxtg_type2_no = #{dxtgType2No}</if>
<if test="dxtgType3 != null and dxtgType3 != ''"> and dxtg_type3 = #{dxtgType3}</if>
<if test="dxtgType3No != null and dxtgType3No != ''"> and dxtg_type3_no = #{dxtgType3No}</if>
<if test="dxtgType4 != null and dxtgType4 != ''"> and dxtg_type4 = #{dxtgType4}</if>
<if test="dxtgType4No != null and dxtgType4No != ''"> and dxtg_type4_no = #{dxtgType4No}</if>
<if test="dxtgType5 != null and dxtgType5 != ''"> and dxtg_type5 = #{dxtgType5}</if>
<if test="dxtgType5No != null and dxtgType5No != ''"> and dxtg_type5_no = #{dxtgType5No}</if>
<if test="reportDate != null "> and report_date = #{reportDate}</if>
<if test="reportDept != null and reportDept != ''"> and report_dept = #{reportDept}</if>
<if test="checkStatus != null "> and check_status = #{checkStatus}</if>
</where>
</select>
<select id="selectCreditMonitorDxtgById" parameterType="Long" resultMap="CreditMonitorDxtgResult">
<include refid="selectCreditMonitorDxtgVo"/>
where id = #{id}
</select>
<insert id="insertCreditMonitorDxtg" parameterType="CreditMonitorDxtg" useGeneratedKeys="true" keyProperty="id">
insert into credit_monitor_dxtg
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="dxtgType1 != null">dxtg_type1,</if>
<if test="dxtgType1No != null">dxtg_type1_no,</if>
<if test="dxtgType2 != null">dxtg_type2,</if>
<if test="dxtgType2No != null">dxtg_type2_no,</if>
<if test="dxtgType3 != null">dxtg_type3,</if>
<if test="dxtgType3No != null">dxtg_type3_no,</if>
<if test="dxtgType4 != null">dxtg_type4,</if>
<if test="dxtgType4No != null">dxtg_type4_no,</if>
<if test="dxtgType5 != null">dxtg_type5,</if>
<if test="dxtgType5No != null">dxtg_type5_no,</if>
<if test="reportDate != null">report_date,</if>
<if test="reportDept != null">report_dept,</if>
<if test="checkStatus != null">check_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="dxtgType1 != null">#{dxtgType1},</if>
<if test="dxtgType1No != null">#{dxtgType1No},</if>
<if test="dxtgType2 != null">#{dxtgType2},</if>
<if test="dxtgType2No != null">#{dxtgType2No},</if>
<if test="dxtgType3 != null">#{dxtgType3},</if>
<if test="dxtgType3No != null">#{dxtgType3No},</if>
<if test="dxtgType4 != null">#{dxtgType4},</if>
<if test="dxtgType4No != null">#{dxtgType4No},</if>
<if test="dxtgType5 != null">#{dxtgType5},</if>
<if test="dxtgType5No != null">#{dxtgType5No},</if>
<if test="reportDate != null">#{reportDate},</if>
<if test="reportDept != null">#{reportDept},</if>
<if test="checkStatus != null">#{checkStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateCreditMonitorDxtg" parameterType="CreditMonitorDxtg">
update credit_monitor_dxtg
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="dxtgType1 != null">dxtg_type1 = #{dxtgType1},</if>
<if test="dxtgType1No != null">dxtg_type1_no = #{dxtgType1No},</if>
<if test="dxtgType2 != null">dxtg_type2 = #{dxtgType2},</if>
<if test="dxtgType2No != null">dxtg_type2_no = #{dxtgType2No},</if>
<if test="dxtgType3 != null">dxtg_type3 = #{dxtgType3},</if>
<if test="dxtgType3No != null">dxtg_type3_no = #{dxtgType3No},</if>
<if test="dxtgType4 != null">dxtg_type4 = #{dxtgType4},</if>
<if test="dxtgType4No != null">dxtg_type4_no = #{dxtgType4No},</if>
<if test="dxtgType5 != null">dxtg_type5 = #{dxtgType5},</if>
<if test="dxtgType5No != null">dxtg_type5_no = #{dxtgType5No},</if>
<if test="checkStatus != null">check_status = #{checkStatus},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCreditMonitorDxtgById" parameterType="Long">
delete from credit_monitor_dxtg where id = #{id}
</delete>
<delete id="deleteCreditMonitorDxtgByIds" parameterType="String">
delete from credit_monitor_dxtg where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDataByIdList" parameterType="Long" resultMap="CreditMonitorDxtgResult">
<include refid="selectCreditMonitorDxtgVo"/> where id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<update id="checkReport" parameterType="Long">
update credit_monitor_dxtg set check_status = 2, report_date = now()
where id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
and check_status = 1
</update>
<insert id="batchSave" parameterType="java.util.List">
insert into credit_monitor_dxtg (id,parent_id, dxtg_type1, dxtg_type1_no, dxtg_type2, dxtg_type2_no, dxtg_type3, dxtg_type3_no, dxtg_type4, dxtg_type4_no, dxtg_type5, dxtg_type5_no, report_date, report_dept,create_by, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.id},#{item.parentId},#{item.dxtgType1},#{item.dxtgType1No},#{item.dxtgType2},#{item.dxtgType2No},
#{item.dxtgType3},#{item.dxtgType3No},#{item.dxtgType4},#{item.dxtgType4No},
#{item.dxtgType5},#{item.dxtgType5No},#{item.reportDate},#{item.reportDept},#{item.createBy},#{item.createTime})
</foreach>
</insert>
<select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
select count(1) from credit_monitor_dxtg
<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="selectDeptCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
select count(distinct report_dept) from credit_monitor_dxtg
<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="selectGroupCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="com.credit.cy.business.model.GroupNumResult">
select report_dept as dept,count(1) as total from credit_monitor_dxtg
<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>
group by report_dept
</select>
</mapper>