CustomerRecoveryProgressMapper.xml
14 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
<?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.chinagas.modules.insight.mapper.CustomerRecoveryProgressMapper">
<resultMap type="com.chinagas.modules.insight.domian.CustomerRecoveryProgress" id="CustomerRecoveryProgressResult">
<result property="id" column="id" />
<result property="area" column="area" />
<result property="areaName" column="area_name" />
<result property="entity" column="entity" />
<result property="entityName" column="entity_name" />
<result property="accounting" column="accounting" />
<result property="accountingName" column="accounting_name" />
<result property="custNo" column="cust_no" />
<result property="custName" column="cust_name" />
<result property="industry" column="industry" />
<result property="status" column="status" />
<result property="yearConsumption" column="year_consumption" />
<result property="lossTime" column="loss_time" />
<result property="lossReason" column="loss_reason" />
<result property="recoverTime" column="recover_time" />
<result property="workPlan" column="work_plan" />
<result property="completion" column="completion" />
<result property="remark" column="remark" />
<result property="sysCtime" column="sys_ctime" />
<result property="sysUtime" column="sys_utime" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<resultMap type="com.chinagas.modules.insight.vo.PoolCountVO" id="PoolResidentLedgerResult1">
<result property="days" column="days" />
<result property="count" column="count" />
</resultMap>
<sql id="selectCustomerRecoveryProgressVo">
select id, area, area_name, entity, entity_name, accounting, accounting_name, cust_no, cust_name, industry, status, year_consumption, loss_time, loss_reason, recover_time, work_plan, completion, remark, sys_ctime, sys_utime, create_by, update_by, delete_flag from customer_recovery_progress
</sql>
<select id="selectCustomerRecoveryProgressList" parameterType="com.chinagas.modules.insight.domian.CustomerRecoveryProgress" resultMap="CustomerRecoveryProgressResult">
<include refid="selectCustomerRecoveryProgressVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="area != null and area != ''"> and area REGEXP #{area}</if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="entity != null and entity != ''"> and entity REGEXP #{entity}</if>
<if test="entityName != null and entityName != ''"> and entity_name like concat('%', #{entityName}, '%')</if>
<if test="accounting != null and accounting != ''"> and accounting REGEXP #{accounting}</if>
<if test="accountingName != null and accountingName != ''"> and accounting_name like concat('%', #{accountingName}, '%')</if>
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="status != null "> and status = #{status}</if>
<if test="yearConsumption != null "> and year_consumption = #{yearConsumption}</if>
<if test="lossTime != null "> and loss_time = #{lossTime}</if>
<if test="lossReason != null and lossReason != ''"> and loss_reason = #{lossReason}</if>
<if test="recoverTime != null "> and recover_time = #{recoverTime}</if>
<if test="workPlan != null and workPlan != ''"> and work_plan = #{workPlan}</if>
<if test="completion != null and completion != ''"> and completion = #{completion}</if>
<if test="sysCtime != null "> and sys_ctime = #{sysCtime}</if>
<if test="sysUtime != null "> and sys_utime = #{sysUtime}</if>
and delete_flag = 0 order by sys_ctime DESC
</where>
</select>
<select id="selectCustomerRecoveryProgressById" parameterType="Long" resultMap="CustomerRecoveryProgressResult">
<include refid="selectCustomerRecoveryProgressVo"/>
where id = #{id}
</select>
<insert id="insertCustomerRecoveryProgress" parameterType="com.chinagas.modules.insight.domian.CustomerRecoveryProgress">
insert into customer_recovery_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="area != null and area != ''">area,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="entity != null and entity != ''">entity,</if>
<if test="entityName != null and entityName != ''">entity_name,</if>
<if test="accounting != null and accounting != ''">accounting,</if>
<if test="accountingName != null and accountingName != ''">accounting_name,</if>
<if test="custNo != null and custNo != ''">cust_no,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="industry != null and industry != ''">industry,</if>
<if test="status != null">status,</if>
<if test="yearConsumption != null">year_consumption,</if>
<if test="lossTime != null">loss_time,</if>
<if test="lossReason != null and lossReason != ''">loss_reason,</if>
<if test="recoverTime != null">recover_time,</if>
<if test="workPlan != null and workPlan != ''">work_plan,</if>
<if test="completion != null and completion != ''">completion,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="sysCtime != null">sys_ctime,</if>
<if test="sysUtime != null">sys_utime,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="deleteFlag != null">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="area != null and area != ''">#{area},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="entity != null and entity != ''">#{entity},</if>
<if test="entityName != null and entityName != ''">#{entityName},</if>
<if test="accounting != null and accounting != ''">#{accounting},</if>
<if test="accountingName != null and accountingName != ''">#{accountingName},</if>
<if test="custNo != null and custNo != ''">#{custNo},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="industry != null and industry != ''">#{industry},</if>
<if test="status != null">#{status},</if>
<if test="yearConsumption != null">#{yearConsumption},</if>
<if test="lossTime != null">#{lossTime},</if>
<if test="lossReason != null and lossReason != ''">#{lossReason},</if>
<if test="recoverTime != null">#{recoverTime},</if>
<if test="workPlan != null and workPlan != ''">#{workPlan},</if>
<if test="completion != null and completion != ''">#{completion},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="sysCtime != null">#{sysCtime},</if>
<if test="sysUtime != null">#{sysUtime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateCustomerRecoveryProgress" parameterType="com.chinagas.modules.insight.domian.CustomerRecoveryProgress">
update customer_recovery_progress
<trim prefix="SET" suffixOverrides=",">
<if test="area != null and area != ''">area = #{area},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="entity != null and entity != ''">entity = #{entity},</if>
<if test="entityName != null and entityName != ''">entity_name = #{entityName},</if>
<if test="accounting != null and accounting != ''">accounting = #{accounting},</if>
<if test="accountingName != null and accountingName != ''">accounting_name = #{accountingName},</if>
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="industry != null and industry != ''">industry = #{industry},</if>
<if test="status != null">status = #{status},</if>
<if test="yearConsumption != null">year_consumption = #{yearConsumption},</if>
<if test="lossTime != null">loss_time = #{lossTime},</if>
<if test="lossReason != null and lossReason != ''">loss_reason = #{lossReason},</if>
<if test="recoverTime != null">recover_time = #{recoverTime},</if>
<if test="workPlan != null and workPlan != ''">work_plan = #{workPlan},</if>
<if test="completion != null and completion != ''">completion = #{completion},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="sysCtime != null">sys_ctime = #{sysCtime},</if>
<if test="sysUtime != null">sys_utime = #{sysUtime},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerRecoveryProgressById" parameterType="Long">
delete from customer_recovery_progress where id = #{id}
</delete>
<delete id="deleteCustomerRecoveryProgressByIds" parameterType="String">
delete from customer_recovery_progress
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCustomerRecoveryProgressByIds" parameterType="Long" resultMap="CustomerRecoveryProgressResult">
<include refid="selectCustomerRecoveryProgressVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectExist" resultMap="CustomerRecoveryProgressResult">
<include refid="selectCustomerRecoveryProgressVo"/>
where cust_no = #{custNo}
and delete_flag = 0
limit 1
</select>
<select id="selectCount" resultType="java.lang.Integer">
select count(*)
from customer_recovery_progress
<where>
<if test="entity != null and entity != ''"> and entity in
<foreach item="entity" collection="entity" open="(" separator="," close=")">
#{entity}
</foreach>
</if>
<if test="area != null and area != ''"> and area = #{area}</if>
</where>
</select>
<select id="selectCount1" resultType="java.lang.Integer">
select count(*)
from customer_recovery_progress
<where>
<if test="area != null and area != ''"> and area = #{area}</if>
</where>
</select>
<select id="selectCountForArea" resultType="java.lang.Integer">
select count(*)
from customer_recovery_progress
<where>
<if test="entity != null and entity != ''"> and entity = #{entity}</if>
</where>
</select>
<select id="selectCountDays" resultMap="PoolResidentLedgerResult1">
select CURDATE() - INTERVAL 6 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 6 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 5 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 5 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 4 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 4 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 3 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 3 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 2 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 2 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 1 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 1 DAY AND entity = 1136) as bbb
UNION
select CURDATE() - INTERVAL 0 day AS days,if(bbb.count = 0,0,bbb.count) AS count
from (select count(1) as count from customer_recovery_progress where date(sys_ctime)=CURDATE() - INTERVAL 0 DAY AND entity = 1136) as bbb
</select>
</mapper>