OrganizeMapper.xml
16.9 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
<?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.OrganizeMapper">
<resultMap type="com.chinagas.modules.insight.domian.Organize" id="OrganizeResult">
<result property="id" column="id" />
<result property="reportNo" column="report_no" />
<result property="reportName" column="report_name" />
<result property="fiscalYear" column="fiscal_year" />
<result property="area" column="area" />
<result property="areaName" column="area_name" />
<result property="budgetSubject" column="budget_subject" />
<result property="entity" column="entity" />
<result property="statusCode" column="status_code" />
<result property="statusName" column="status_name" />
<result property="validityTimeStart" column="validity_time_start" />
<result property="validityTimeEnd" column="validity_time_end" />
<result property="leader" column="leader" />
<result property="deputyLeader" column="deputy_leader" />
<result property="member" column="member" />
<result property="implementationSituation" column="implementation_situation" />
<result property="attachmentsUrl" column="attachments_url" />
<result property="appraisalResult" column="appraisal_result" />
<result property="rejectReason" column="reject_reason" />
<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="seeProfession" column="see_profession" />
<result property="seeMarket" column="see_market" />
<result property="seeCompete" column="see_compete" />
<result property="seeSelf" column="see_self" />
<result property="seeChance" column="see_chance" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectOrganizeVo">
select id, report_no, report_name, fiscal_year, area, area_name, budget_subject, entity, status_code, status_name, validity_time_start, validity_time_end,
leader, deputy_leader, member, implementation_situation, attachments_url, reject_reason, appraisal_result, sys_ctime, sys_utime,
create_by, update_by, see_profession, see_market, see_compete, see_self, see_chance, delete_flag from organize
</sql>
<select id="selectOrganizeList" parameterType="com.chinagas.modules.insight.vo.OrganizeVO" resultMap="OrganizeResult">
<include refid="selectOrganizeVo"/>
<where>
<if test="reportNo != null and reportNo != ''"> and report_no = #{reportNo}</if>
<if test="reportName != null and reportName != ''"> and report_name like concat('%', #{reportName}, '%')</if>
<if test="fiscalYear != null and fiscalYear != '' "> and fiscal_year REGEXP #{fiscalYear}</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="budgetSubject != null and budgetSubject != ''"> and budget_subject REGEXP #{budgetSubject}</if>
<if test="entity != null and entity != ''"> and entity REGEXP #{entity}</if>
<if test="statusCode != null "> and status_code = #{statusCode}</if>
<if test="statusName != null "> and status_name like concat('%', #{statusName}, '%')</if>
<if test="validityTimeStart != null "> and validity_time_start = #{validityTimeStart}</if>
<if test="validityTimeEnd != null "> and validity_time_end = #{validityTimeEnd}</if>
<if test="leader != null and leader != ''"> and leader = #{leader}</if>
<if test="deputyLeader != null and deputyLeader != ''"> and deputy_leader = #{deputyLeader}</if>
<if test="member != null and member != ''"> and member = #{member}</if>
<if test="implementationSituation != null and implementationSituation != ''"> and implementation_situation = #{implementationSituation}</if>
<if test="attachmentsUrl != null and attachmentsUrl != ''"> and attachments_url = #{attachmentsUrl}</if>
<if test="rejectReason != null and rejectReason != ''"> and reject_reason = #{rejectReason}</if>
<if test="appraisalResult != null "> and appraisal_result = #{appraisalResult}</if>
<if test="sysCtime != null "> and sys_ctime = #{sysCtime}</if>
<if test="sysUtime != null "> and sys_utime = #{sysUtime}</if>
<if test="seeProfession != null and seeProfession != ''"> and see_profession = #{seeProfession}</if>
<if test="seeMarket != null and seeMarket != ''"> and see_market = #{seeMarket}</if>
<if test="seeCompete != null and seeCompete != ''"> and see_compete = #{seeCompete}</if>
<if test="seeSelf != null and seeSelf != ''"> and see_self = #{seeSelf}</if>
<if test="seeChance != null and seeChance != ''"> and see_chance = #{seeChance}</if>
and delete_flag = 0 order by sys_ctime DESC
</where>
</select>
<select id="selectOrganizeById" resultMap="OrganizeResult">
<include refid="selectOrganizeVo"/>
where report_no = #{reportNo}
</select>
<insert id="insertOrganize" parameterType="com.chinagas.modules.insight.domian.Organize">
insert into organize
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="reportNo != null and reportNo != ''">report_no,</if>
<if test="reportName != null and reportName != ''">report_name,</if>
<if test="fiscalYear != null">fiscal_year,</if>
<if test="area != null and area != ''">area,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="budgetSubject != null and budgetSubject != ''">budget_subject,</if>
<if test="entity != null and entity != ''">entity,</if>
<if test="statusCode != null">status_code,</if>
<if test="statusName != null">status_name,</if>
<if test="validityTimeStart != null">validity_time_start,</if>
<if test="validityTimeEnd != null">validity_time_end,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="deputyLeader != null and deputyLeader != ''">deputy_leader,</if>
<if test="member != null and member != ''">member,</if>
<if test="implementationSituation != null and implementationSituation != ''">implementation_situation,</if>
<if test="attachmentsUrl != null and attachmentsUrl != ''">attachments_url,</if>
<if test="rejectReason != null and rejectReason != ''">reject_reason,</if>
<if test="appraisalResult != null ">appraisal_result,</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="seeProfession != null and seeProfession != ''">see_profession,</if>
<if test="seeMarket != null and seeMarket != ''">see_market,</if>
<if test="seeCompete != null and seeCompete != ''">see_compete,</if>
<if test="seeSelf != null and seeSelf != ''">see_self,</if>
<if test="seeChance != null and seeChance != ''">see_chance,</if>
<if test="deleteFlag != null">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="reportNo != null and reportNo != ''">#{reportNo},</if>
<if test="reportName != null and reportName != ''">#{reportName},</if>
<if test="fiscalYear != null">#{fiscalYear},</if>
<if test="area != null and area != ''">#{area},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="budgetSubject != null and budgetSubject != ''">#{budgetSubject},</if>
<if test="entity != null and entity != ''">#{entity},</if>
<if test="statusCode != null">#{statusCode},</if>
<if test="statusName != null">#{statusName},</if>
<if test="validityTimeStart != null">#{validityTimeStart},</if>
<if test="validityTimeEnd != null">#{validityTimeEnd},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="deputyLeader != null and deputyLeader != ''">#{deputyLeader},</if>
<if test="member != null and member != ''">#{member},</if>
<if test="implementationSituation != null and implementationSituation != ''">#{implementationSituation},</if>
<if test="attachmentsUrl != null and attachmentsUrl != ''">#{attachmentsUrl},</if>
<if test="rejectReason != null and rejectReason != ''">#{rejectReason},</if>
<if test="appraisalResult != null ">#{appraisalResult},</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="seeProfession != null and seeProfession != ''">#{seeProfession},</if>
<if test="seeMarket != null and seeMarket != ''">#{seeMarket},</if>
<if test="seeCompete != null and seeCompete != ''">#{seeCompete},</if>
<if test="seeSelf != null and seeSelf != ''">#{seeSelf},</if>
<if test="seeChance != null and seeChance != ''">#{seeChance},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateOrganize" parameterType="com.chinagas.modules.insight.domian.Organize">
update organize
<trim prefix="SET" suffixOverrides=",">
<if test="reportName != null and reportName != ''">report_name = #{reportName},</if>
<if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
<if test="area != null and area != ''">area = #{area},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="budgetSubject != null and budgetSubject != ''">budget_subject = #{budgetSubject},</if>
<if test="entity != null and entity != ''">entity = #{entity},</if>
<if test="statusCode != null">status_code = #{statusCode},</if>
<if test="statusName != null">status_name = #{statusName},</if>
<if test="validityTimeStart != null">validity_time_start = #{validityTimeStart},</if>
<if test="validityTimeEnd != null">validity_time_end = #{validityTimeEnd},</if>
<if test="leader != null and leader != ''">leader = #{leader},</if>
<if test="deputyLeader != null and deputyLeader != ''">deputy_leader = #{deputyLeader},</if>
<if test="member != null and member != ''">member = #{member},</if>
<if test="implementationSituation != null and implementationSituation != ''">implementation_situation = #{implementationSituation},</if>
<if test="attachmentsUrl != null and attachmentsUrl != ''">attachments_url = #{attachmentsUrl},</if>
<if test="rejectReason != null and rejectReason != ''">reject_reason = #{rejectReason},</if>
<if test="appraisalResult != null ">appraisal_result = #{appraisalResult},</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="seeProfession != null and seeProfession != ''">see_profession = #{seeProfession},</if>
<if test="seeMarket != null and seeMarket != ''">see_market = #{seeMarket},</if>
<if test="seeCompete != null and seeCompete != ''">see_compete = #{seeCompete},</if>
<if test="seeSelf != null and seeSelf != ''">see_self = #{seeSelf},</if>
<if test="seeChance != null and seeChance != ''">see_chance = #{seeChance},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
</trim>
where report_no = #{reportNo}
</update>
<update id="deleteOrganizeById" parameterType="com.chinagas.modules.insight.domian.Organize">
update organize
<trim prefix="SET" suffixOverrides=",">
delete_flag = 1
</trim>
where report_no = #{reportNo}
</update>
<!-- <delete id="deleteOrganizeById" parameterType="Long">-->
<!-- delete from organize where id = #{id}-->
<!-- </delete>-->
<delete id="deleteOrganizeByIds" parameterType="String">
delete from organize where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByReportNameExist" resultMap="OrganizeResult">
select * from organize
where report_name = #{reportName}
and delete_flag = 0
limit 1
</select>
<update id="updateByReportNo" parameterType="com.chinagas.modules.insight.domian.Organize">
update organize
<trim prefix="SET" suffixOverrides=",">
<if test="reportName != null and reportName != ''">report_name = #{reportName},</if>
<if test="fiscalYear != null">fiscal_year = #{fiscalYear},</if>
<if test="area != null and area != ''">area = #{area},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="budgetSubject != null and budgetSubject != ''">budget_subject = #{budgetSubject},</if>
<if test="entity != null and entity != ''">entity = #{entity},</if>
<if test="statusCode != null">status_code = #{statusCode},</if>
<if test="statusName != null">status_name = #{statusName},</if>
<if test="validityTimeStart != null">validity_time_start = #{validityTimeStart},</if>
<if test="validityTimeEnd != null">validity_time_end = #{validityTimeEnd},</if>
<if test="leader != null and leader != ''">leader = #{leader},</if>
<if test="deputyLeader != null and deputyLeader != ''">deputy_leader = #{deputyLeader},</if>
<if test="member != null and member != ''">member = #{member},</if>
<if test="implementationSituation != null and implementationSituation != ''">implementation_situation = #{implementationSituation},</if>
<if test="attachmentsUrl != null and attachmentsUrl != ''">attachments_url = #{attachmentsUrl},</if>
<if test="rejectReason != null and rejectReason != ''">reject_reason = #{rejectReason},</if>
<if test="appraisalResult != null ">appraisal_result = #{appraisalResult},</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="sProfession != null and sProfession != ''">s_profession = #{sProfession},</if>
<if test="sMarket != null and sMarket != ''">s_market = #{sMarket},</if>
<if test="sCompete != null and sCompete != ''">s_compete = #{sCompete},</if>
<if test="sSelf != null and sSelf != ''">s_self = #{sSelf},</if>
<if test="sChance != null and sChance != ''">s_chance = #{sChance},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
</trim>
where report_no = #{reportNo}
</update>
<select id="selectCountByStatus" resultType="java.lang.Integer">
select count(*)
from organize
where status_code = #{status}
and fiscal_year = #{fiscalYear}
<if test="entity != null and entity != ''"> and entity REGEXP #{entity}</if>
and delete_flag = 0
</select>
<select id="countGrowth" parameterType="String" resultType="int">
SELECT count(1) FROM organize WHERE sys_ctime like concat (#{formatTime}, '%') and delete_flag = 0
</select>
<select id="selectOrganizeListByMonth" resultMap="OrganizeResult">
SELECT * FROM organize WHERE PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sys_ctime, '%Y%m' ) ) =1
and delete_flag = 0
</select>
</mapper>