PoolIndustryAndCommerceMapper.xml
13.6 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
<?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.PoolIndustryAndCommerceMapper">
<resultMap type="com.chinagas.modules.insight.domian.PoolIndustryAndCommerce" id="PoolIndustryAndCommerceResult">
<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="clientName" column="client_name" />
<result property="taxpayerNumber" column="taxpayer_number" />
<result property="clientAddress" column="client_address" />
<result property="clientQuality" column="client_quality" />
<result property="industry" column="industry" />
<result property="predictDay" column="predict_day" />
<result property="predictYear" column="predict_year" />
<result property="predictInstall" column="predict_install" />
<result property="status" column="status" />
<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="selectPoolIndustryAndCommerceVo">
select id, area, area_name, entity, entity_name, accounting, accounting_name, client_name, taxpayer_number, client_address, client_quality, industry, predict_day, predict_year, predict_install, status, sys_ctime, sys_utime, create_by, update_by, delete_flag from pool_industry_and_commerce
</sql>
<select id="selectPoolIndustryAndCommerceList" parameterType="com.chinagas.modules.insight.domian.PoolIndustryAndCommerce" resultMap="PoolIndustryAndCommerceResult">
<include refid="selectPoolIndustryAndCommerceVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="area != null and area != ''"> and area = #{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="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
<if test="taxpayerNumber != null and taxpayerNumber != ''"> and taxpayer_number = #{taxpayerNumber}</if>
<if test="clientAddress != null and clientAddress != ''"> and client_address = #{clientAddress}</if>
<if test="clientQuality != null "> and client_quality = #{clientQuality}</if>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="predictDay != null and predictDay != ''"> and predict_day = #{predictDay}</if>
<if test="predictYear != null and predictYear != ''"> and predict_year = #{predictYear}</if>
<if test="predictInstall != null "> and predict_install = #{predictInstall}</if>
<if test="status != null "> and status REGEXP #{status}</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="selectPoolIndustryAndCommerceById" parameterType="Long" resultMap="PoolIndustryAndCommerceResult">
<include refid="selectPoolIndustryAndCommerceVo"/>
where id = #{id}
</select>
<insert id="insertPoolIndustryAndCommerce" parameterType="com.chinagas.modules.insight.domian.PoolIndustryAndCommerce">
insert into pool_industry_and_commerce
<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="clientName != null and clientName != ''">client_name,</if>
<if test="taxpayerNumber != null and taxpayerNumber != ''">taxpayer_number,</if>
<if test="clientAddress != null and clientAddress != ''">client_address,</if>
<if test="clientQuality != null">client_quality,</if>
<if test="industry != null and industry != ''">industry,</if>
<if test="predictDay != null and predictDay != ''">predict_day,</if>
<if test="predictYear != null and predictYear != ''">predict_year,</if>
<if test="predictInstall != null">predict_install,</if>
<if test="status != null">status,</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="clientName != null and clientName != ''">#{clientName},</if>
<if test="taxpayerNumber != null and taxpayerNumber != ''">#{taxpayerNumber},</if>
<if test="clientAddress != null and clientAddress != ''">#{clientAddress},</if>
<if test="clientQuality != null">#{clientQuality},</if>
<if test="industry != null and industry != ''">#{industry},</if>
<if test="predictDay != null and predictDay != ''">#{predictDay},</if>
<if test="predictYear != null and predictYear != ''">#{predictYear},</if>
<if test="predictInstall != null">#{predictInstall},</if>
<if test="status != null">#{status},</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="updatePoolIndustryAndCommerce" parameterType="com.chinagas.modules.insight.domian.PoolIndustryAndCommerce">
update pool_industry_and_commerce
<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="clientName != null and clientName != ''">client_name = #{clientName},</if>
<if test="taxpayerNumber != null and taxpayerNumber != ''">taxpayer_number = #{taxpayerNumber},</if>
<if test="clientAddress != null and clientAddress != ''">client_address = #{clientAddress},</if>
<if test="clientQuality != null">client_quality = #{clientQuality},</if>
<if test="industry != null and industry != ''">industry = #{industry},</if>
<if test="predictDay != null and predictDay != ''">predict_day = #{predictDay},</if>
<if test="predictYear != null and predictYear != ''">predict_year = #{predictYear},</if>
<if test="predictInstall != null">predict_install = #{predictInstall},</if>
<if test="status != null">status = #{status},</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="deletePoolIndustryAndCommerceById" parameterType="Long">
delete from pool_industry_and_commerce where id = #{id}
</delete>
<delete id="deletePoolIndustryAndCommerceByIds" parameterType="String">
delete from pool_industry_and_commerce
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPoolIndustryAndCommerceByIds" parameterType="Long" resultMap="PoolIndustryAndCommerceResult">
<include refid="selectPoolIndustryAndCommerceVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectExist" resultMap="PoolIndustryAndCommerceResult">
<include refid="selectPoolIndustryAndCommerceVo"/>
where taxpayer_number = #{taxpayerNumber}
and delete_flag = 0
limit 1
</select>
<select id="selectCount" resultType="java.lang.Integer">
select count(*)
from pool_industry_and_commerce
<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 pool_industry_and_commerce
<where>
<if test="area != null and area != ''"> and area = #{area}</if>
</where>
</select>
<select id="selectCountForArea" resultType="java.lang.Integer">
select count(*)
from pool_industry_and_commerce
<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 pool_industry_and_commerce 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 pool_industry_and_commerce 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 pool_industry_and_commerce 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 pool_industry_and_commerce 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 pool_industry_and_commerce where date(sys_ctime)=CURDATE() - INTERVAL 3 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 pool_industry_and_commerce where date(sys_ctime)=CURDATE() - INTERVAL 2 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 pool_industry_and_commerce where date(sys_ctime)=CURDATE() - INTERVAL 0 DAY AND entity = 1136) as bbb
</select>
</mapper>