郑永安
2023-08-23 0a9ed7b7488de66a50799f79369d7806910ae00a
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<?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.gk.hotwork.Mapper.SafetyFacilityInspectionMapper" >
  <resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="valid_flag" property="validFlag" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="submit_date" property="submitDate" jdbcType="DATE" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="project_name" property="projectName" jdbcType="VARCHAR" />
    <result column="progress" property="progress" jdbcType="INTEGER" />
    <result column="expert" property="expert" jdbcType="VARCHAR" />
    <result column="contact" property="contact" jdbcType="VARCHAR" />
    <result column="telephone" property="telephone" jdbcType="VARCHAR" />
    <result column="company" property="company" jdbcType="VARCHAR" />
    <result column="accept_time" property="acceptTime" jdbcType="TIMESTAMP" />
    <result column="review_time" property="reviewTime" jdbcType="TIMESTAMP" />
    <result column="examine_time" property="examineTime" jdbcType="TIMESTAMP" />
    <result column="correctpdf" property="correctpdf" jdbcType="VARCHAR" />
    <result column="examine_pageno" property="examinePageno" jdbcType="VARCHAR" />
    <result column="examine_taketime" property="examineTaketime" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, valid_flag, create_time, create_by, update_time, submit_date, type, project_name, 
    progress, expert, contact, telephone, company, accept_time, review_time, examine_time, 
    correctpdf, examine_pageno, examine_taketime
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select 
    <include refid="Base_Column_List" />
    from safety_facility_inspection
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from safety_facility_inspection
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
    insert into safety_facility_inspection (id, valid_flag, create_time, 
      create_by, update_time, submit_date, 
      type, project_name, progress, 
      expert, contact, telephone, 
      company, accept_time, review_time, 
      examine_time, correctpdf, examine_pageno, 
      examine_taketime)
    values (#{id,jdbcType=BIGINT}, #{validFlag,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{submitDate,jdbcType=DATE}, 
      #{type,jdbcType=INTEGER}, #{projectName,jdbcType=VARCHAR}, #{progress,jdbcType=INTEGER}, 
      #{expert,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, 
      #{company,jdbcType=VARCHAR}, #{acceptTime,jdbcType=TIMESTAMP}, #{reviewTime,jdbcType=TIMESTAMP}, 
      #{examineTime,jdbcType=TIMESTAMP}, #{correctpdf,jdbcType=VARCHAR}, #{examinePageno,jdbcType=VARCHAR}, 
      #{examineTaketime,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
    insert into safety_facility_inspection
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="validFlag != null" >
        valid_flag,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="submitDate != null" >
        submit_date,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="projectName != null" >
        project_name,
      </if>
      <if test="progress != null" >
        progress,
      </if>
      <if test="expert != null" >
        expert,
      </if>
      <if test="contact != null" >
        contact,
      </if>
      <if test="telephone != null" >
        telephone,
      </if>
      <if test="company != null" >
        company,
      </if>
      <if test="acceptTime != null" >
        accept_time,
      </if>
      <if test="reviewTime != null" >
        review_time,
      </if>
      <if test="examineTime != null" >
        examine_time,
      </if>
      <if test="correctpdf != null" >
        correctpdf,
      </if>
      <if test="examinePageno != null" >
        examine_pageno,
      </if>
      <if test="examineTaketime != null" >
        examine_taketime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="validFlag != null" >
        #{validFlag,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="submitDate != null" >
        #{submitDate,jdbcType=DATE},
      </if>
      <if test="type != null" >
        #{type,jdbcType=INTEGER},
      </if>
      <if test="projectName != null" >
        #{projectName,jdbcType=VARCHAR},
      </if>
      <if test="progress != null" >
        #{progress,jdbcType=INTEGER},
      </if>
      <if test="expert != null" >
        #{expert,jdbcType=VARCHAR},
      </if>
      <if test="contact != null" >
        #{contact,jdbcType=VARCHAR},
      </if>
      <if test="telephone != null" >
        #{telephone,jdbcType=VARCHAR},
      </if>
      <if test="company != null" >
        #{company,jdbcType=VARCHAR},
      </if>
      <if test="acceptTime != null" >
        #{acceptTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reviewTime != null" >
        #{reviewTime,jdbcType=TIMESTAMP},
      </if>
      <if test="examineTime != null" >
        #{examineTime,jdbcType=TIMESTAMP},
      </if>
      <if test="correctpdf != null" >
        #{correctpdf,jdbcType=VARCHAR},
      </if>
      <if test="examinePageno != null" >
        #{examinePageno,jdbcType=VARCHAR},
      </if>
      <if test="examineTaketime != null" >
        #{examineTaketime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
    update safety_facility_inspection
    <set >
      <if test="validFlag != null" >
        valid_flag = #{validFlag,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="submitDate != null" >
        submit_date = #{submitDate,jdbcType=DATE},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="projectName != null" >
        project_name = #{projectName,jdbcType=VARCHAR},
      </if>
      <if test="progress != null" >
        progress = #{progress,jdbcType=INTEGER},
      </if>
      <if test="expert != null" >
        expert = #{expert,jdbcType=VARCHAR},
      </if>
      <if test="contact != null" >
        contact = #{contact,jdbcType=VARCHAR},
      </if>
      <if test="telephone != null" >
        telephone = #{telephone,jdbcType=VARCHAR},
      </if>
      <if test="company != null" >
        company = #{company,jdbcType=VARCHAR},
      </if>
      <if test="acceptTime != null" >
        accept_time = #{acceptTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reviewTime != null" >
        review_time = #{reviewTime,jdbcType=TIMESTAMP},
      </if>
      <if test="examineTime != null" >
        examine_time = #{examineTime,jdbcType=TIMESTAMP},
      </if>
      <if test="correctpdf != null" >
        correctpdf = #{correctpdf,jdbcType=VARCHAR},
      </if>
      <if test="examinePageno != null" >
        examine_pageno = #{examinePageno,jdbcType=VARCHAR},
      </if>
      <if test="examineTaketime != null" >
        examine_taketime = #{examineTaketime,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.hotwork.Domain.SafetyFacilityInspection" >
    <!--          -->
    update safety_facility_inspection
    set valid_flag = #{validFlag,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_by = #{createBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      submit_date = #{submitDate,jdbcType=DATE},
      type = #{type,jdbcType=INTEGER},
      project_name = #{projectName,jdbcType=VARCHAR},
      progress = #{progress,jdbcType=INTEGER},
      expert = #{expert,jdbcType=VARCHAR},
      contact = #{contact,jdbcType=VARCHAR},
      telephone = #{telephone,jdbcType=VARCHAR},
      company = #{company,jdbcType=VARCHAR},
      accept_time = #{acceptTime,jdbcType=TIMESTAMP},
      review_time = #{reviewTime,jdbcType=TIMESTAMP},
      examine_time = #{examineTime,jdbcType=TIMESTAMP},
      correctpdf = #{correctpdf,jdbcType=VARCHAR},
      examine_pageno = #{examinePageno,jdbcType=VARCHAR},
      examine_taketime = #{examineTaketime,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="selectPages" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from safety_facility_inspection
    where valid_flag = 1 
    <if test="params.submitDateStartTime != null  and params.submitDateStartTime != ''">
      and submit_date &gt;=#{params.submitDateStartTime,jdbcType=VARCHAR} 
    </if>
    <if test="params.submitDateEndTime != null  and params.submitDateEndTime != ''">
      and submit_date &lt;=#{params.submitDateEndTime,jdbcType=VARCHAR} 
    </if>
    <if test="params.expert != null  and params.expert != ''">
        and expert like concat("%",#{params.expert,jdbcType=VARCHAR},"%")
    </if>
    <if test="params.progress != null ">
      and progress = #{params.progress,jdbcType=INTEGER}
    </if>
    <if test="params.type != null and params.type != ''">
      and type = #{params.type,jdbcType=INTEGER}
    </if>
       <if test="params.createBy != null and params.createBy != ''">
      and create_by = #{params.createBy,jdbcType=VARCHAR}
    </if>
    <if test="params.company != null and params.company.size > 0">
      and company in
      <foreach collection="params.company" index="index" item="item" open="(" separator="," close=")">
          #{item}
      </foreach>
     </if>     
    ORDER BY
    type,
    create_time DESC
  </select>
  
</mapper>