地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?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.javaweb.geo.mapper.HoleBiaoguanMapper">
    
    <resultMap type="HoleBiaoguan" id="HoleBiaoguanResult">
        <result property="ids"    column="ids"    />
        <result property="code"    column="code"    />
        <result property="projectId"    column="project_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="drillLength"    column="drill_length"    />
        <result property="begin1"    column="begin1"    />
        <result property="end1"    column="end1"    />
        <result property="blow1"    column="blow1"    />
        <result property="begin2"    column="begin2"    />
        <result property="end2"    column="end2"    />
        <result property="blow2"    column="blow2"    />
        <result property="begin3"    column="begin3"    />
        <result property="end3"    column="end3"    />
        <result property="blow3"    column="blow3"    />
        <result property="begin4"    column="begin4"    />
        <result property="end4"    column="end4"    />
        <result property="blow4"    column="blow4"    />
        <result property="powerType"    column="power_type"    />
        <result property="type"    column="type"    />
        <result property="title"    column="title"    />
        <result property="createTime"    column="create_time"    />
        <result property="recordPerson"    column="record_person"    />
        <result property="recordPersonName"    column="record_person_name"    />
        <result property="description"    column="description"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="gpsTime"    column="gps_time"    />
        <result property="isDelete"    column="is_delete"    />
        <result property="position"    column="position"    />
        <result property="locateTime"    column="locate_time"    />
        <result property="reason"    column="reason"    />
        <result property="pic1"    column="pic1"    />
        <result property="pic2"    column="pic2"    />
        <result property="pic3"    column="pic3"    />
        <!--select子查询, column 传给子查询的参数-->
<!--        <collection property="holeMediaList" ofType="com.javaweb.geo.domain.HoleMedia" select="queryDetail" column="ids" />-->
    </resultMap>
 
    <resultMap type="HoleMedia" id="HoleMediaResult">
        <result property="ids"    column="ids"    />
        <result property="recordId"    column="record_id"    />
        <result property="projectId"    column="project_id"    />
        <result property="name"    column="name"    />
        <result property="createTime"    column="create_time"  jdbcType="TIMESTAMP" />
        <result property="type"    column="type"    />
        <result property="internetPath"    column="internet_path"    />
        <result property="createUser"    column="create_user"    />
        <result property="uploadUser"    column="upload_user"    />
    </resultMap>
 
    <!--子查询的sql-->
    <select id="queryDetail" resultMap="HoleMediaResult">
       SELECT * FROM js_hole_media where record_id = #{ids}
    </select>
 
    <sql id="selectHoleBiaoguanVo">
        select ids,code, project_id, hole_id, drill_length, begin1, end1, blow1, begin2, end2, blow2, begin3, end3, blow3, begin4, end4, blow4, power_type, type, title, create_time, record_person, description, longitude, latitude, gps_time, is_delete, position, locate_time, reason, pic1, pic2, pic3 from js_hole_biaoguan
    </sql>
 
    <select id="selectHoleBiaoguanList" parameterType="HoleBiaoguan" resultMap="HoleBiaoguanResult">
        SELECT
        b.ids,
        b.CODE,
        b.project_id,
        b.hole_id,
        b.drill_length,
        b.begin1,
        b.end1,
        b.blow1,
        b.begin2,
        b.end2,
        b.blow2,
        b.begin3,
        b.end3,
        b.blow3,
        b.begin4,
        b.end4,
        b.blow4,
        b.power_type,
        b.type,
        b.title,
        b.create_time,
        b.record_person,
        u.real_name AS record_person_name,
        b.description,
        b.longitude,
        b.latitude,
        b.gps_time,
        b.is_delete,
        b.position,
        b.locate_time,
        b.reason,
        b.pic1,
        b.pic2,
        b.pic3
        FROM
        js_hole_biaoguan b LEFT JOIN js_company_user u ON b.record_person = u.ids
        <where>
            <if test="projectId != null  and projectId != ''"> and b.project_id = #{projectId}</if>
            <if test="holeId != null  and holeId != ''"> and b.hole_id = #{holeId}</if>
            <if test="drillLength != null  and drillLength != ''"> and b.drill_length = #{drillLength}</if>
            <if test="begin1 != null  and begin1 != ''"> and b.begin1 = #{begin1}</if>
            <if test="end1 != null  and end1 != ''"> and b.end1 = #{end1}</if>
            <if test="blow1 != null  and blow1 != ''"> and b.blow1 = #{blow1}</if>
            <if test="begin2 != null  and begin2 != ''"> and b.begin2 = #{begin2}</if>
            <if test="end2 != null  and end2 != ''"> and b.end2 = #{end2}</if>
            <if test="blow2 != null  and blow2 != ''"> and b.blow2 = #{blow2}</if>
            <if test="begin3 != null  and begin3 != ''"> and b.begin3 = #{begin3}</if>
            <if test="end3 != null  and end3 != ''"> and b.end3 = #{end3}</if>
            <if test="blow3 != null  and blow3 != ''"> and b.blow3 = #{blow3}</if>
            <if test="begin4 != null  and begin4 != ''"> and b.begin4 = #{begin4}</if>
            <if test="end4 != null  and end4 != ''"> and b.end4 = #{end4}</if>
            <if test="blow4 != null  and blow4 != ''"> and b.blow4 = #{blow4}</if>
            <if test="powerType != null  and powerType != ''"> and b.power_type = #{powerType}</if>
            <if test="type != null  and type != ''"> and b.type = #{type}</if>
            <if test="title != null  and title != ''"> and b.title = #{title}</if>
            <if test="recordPerson != null  and recordPerson != ''"> and b.record_person = #{recordPerson}</if>
            <if test="description != null  and description != ''"> and b.description = #{description}</if>
            <if test="longitude != null "> and b.longitude = #{longitude}</if>
            <if test="latitude != null "> and b.latitude = #{latitude}</if>
            <if test="gpsTime != null "> and b.gps_time = #{gpsTime}</if>
            <if test="isDelete != null  and isDelete != ''"> and b.is_delete = #{isDelete}</if>
            <if test="position != null  and position != ''"> and b.position = #{position}</if>
            <if test="locateTime != null "> and b.locate_time = #{locateTime}</if>
            <if test="reason != null  and reason != ''"> and b.reason = #{reason}</if>
            <if test="pic1 != null  and pic1 != ''"> and b.pic1 = #{pic1}</if>
            <if test="pic2 != null  and pic2 != ''"> and b.pic2 = #{pic2}</if>
            <if test="pic3 != null  and pic3 != ''"> and b.pic3 = #{pic3}</if>
        </where>
        ORDER BY b.CODE ASC
    </select>
    
    <select id="selectHoleBiaoguanById" parameterType="String" resultMap="HoleBiaoguanResult">
        SELECT
        b.ids,
        b.CODE,
        b.project_id,
        b.hole_id,
        b.drill_length,
        b.begin1,
        b.end1,
        b.blow1,
        b.begin2,
        b.end2,
        b.blow2,
        b.begin3,
        b.end3,
        b.blow3,
        b.begin4,
        b.end4,
        b.blow4,
        b.power_type,
        b.type,
        b.title,
        b.create_time,
        b.record_person,
        u.real_name AS record_person_name,
        b.description,
        b.longitude,
        b.latitude,
        b.gps_time,
        b.is_delete,
        b.position,
        b.locate_time,
        b.reason,
        b.pic1,
        b.pic2,
        b.pic3
        FROM
        js_hole_biaoguan b LEFT JOIN js_company_user u ON b.record_person = u.ids where b.ids = #{ids}
    </select>
 
    <select id="countNumberByProjectId" resultType="java.lang.Long">
        SELECT count(ids) FROM js_hole_biaoguan where project_id = #{projectId} AND type = #{type}
    </select>
 
    <select id="selectHoleBiaoguanByHoleId" parameterType="String" resultMap="HoleBiaoguanResult">
        <include refid="selectHoleBiaoguanVo"/> where hole_id = #{holeId}
    </select>
 
    <select id="selectHoleBiaoguanByProjectId" parameterType="String" resultMap="HoleBiaoguanResult">
        <include refid="selectHoleBiaoguanVo"/> project_id = #{projectId}
    </select>
 
    <insert id="insertHoleBiaoguan" parameterType="HoleBiaoguan">
        insert into js_hole_biaoguan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">ids,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="projectId != null  and projectId != ''">project_id,</if>
            <if test="holeId != null  and holeId != ''">hole_id,</if>
            <if test="drillLength != null  and drillLength != ''">drill_length,</if>
            <if test="begin1 != null  and begin1 != ''">begin1,</if>
            <if test="end1 != null  and end1 != ''">end1,</if>
            <if test="blow1 != null  and blow1 != ''">blow1,</if>
            <if test="begin2 != null  and begin2 != ''">begin2,</if>
            <if test="end2 != null  and end2 != ''">end2,</if>
            <if test="blow2 != null  and blow2 != ''">blow2,</if>
            <if test="begin3 != null  and begin3 != ''">begin3,</if>
            <if test="end3 != null  and end3 != ''">end3,</if>
            <if test="blow3 != null  and blow3 != ''">blow3,</if>
            <if test="begin4 != null  and begin4 != ''">begin4,</if>
            <if test="end4 != null  and end4 != ''">end4,</if>
            <if test="blow4 != null  and blow4 != ''">blow4,</if>
            <if test="powerType != null  and powerType != ''">power_type,</if>
            <if test="type != null  and type != ''">type,</if>
            <if test="title != null  and title != ''">title,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="recordPerson != null  and recordPerson != ''">record_person,</if>
            <if test="description != null  and description != ''">description,</if>
            <if test="longitude != null ">longitude,</if>
            <if test="latitude != null ">latitude,</if>
            <if test="gpsTime != null ">gps_time,</if>
            <if test="isDelete != null  and isDelete != ''">is_delete,</if>
            <if test="position != null  and position != ''">position,</if>
            <if test="locateTime != null ">locate_time,</if>
            <if test="reason != null  and reason != ''">reason,</if>
            <if test="pic1 != null  and pic1 != ''">pic1,</if>
            <if test="pic2 != null  and pic2 != ''">pic2,</if>
            <if test="pic3 != null  and pic3 != ''">pic3,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="projectId != null  and projectId != ''">#{projectId},</if>
            <if test="holeId != null  and holeId != ''">#{holeId},</if>
            <if test="drillLength != null  and drillLength != ''">#{drillLength},</if>
            <if test="begin1 != null  and begin1 != ''">#{begin1},</if>
            <if test="end1 != null  and end1 != ''">#{end1},</if>
            <if test="blow1 != null  and blow1 != ''">#{blow1},</if>
            <if test="begin2 != null  and begin2 != ''">#{begin2},</if>
            <if test="end2 != null  and end2 != ''">#{end2},</if>
            <if test="blow2 != null  and blow2 != ''">#{blow2},</if>
            <if test="begin3 != null  and begin3 != ''">#{begin3},</if>
            <if test="end3 != null  and end3 != ''">#{end3},</if>
            <if test="blow3 != null  and blow3 != ''">#{blow3},</if>
            <if test="begin4 != null  and begin4 != ''">#{begin4},</if>
            <if test="end4 != null  and end4 != ''">#{end4},</if>
            <if test="blow4 != null  and blow4 != ''">#{blow4},</if>
            <if test="powerType != null  and powerType != ''">#{powerType},</if>
            <if test="type != null  and type != ''">#{type},</if>
            <if test="title != null  and title != ''">#{title},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="recordPerson != null  and recordPerson != ''">#{recordPerson},</if>
            <if test="description != null  and description != ''">#{description},</if>
            <if test="longitude != null ">#{longitude},</if>
            <if test="latitude != null ">#{latitude},</if>
            <if test="gpsTime != null ">#{gpsTime},</if>
            <if test="isDelete != null  and isDelete != ''">#{isDelete},</if>
            <if test="position != null  and position != ''">#{position},</if>
            <if test="locateTime != null ">#{locateTime},</if>
            <if test="reason != null  and reason != ''">#{reason},</if>
            <if test="pic1 != null  and pic1 != ''">#{pic1},</if>
            <if test="pic2 != null  and pic2 != ''">#{pic2},</if>
            <if test="pic3 != null  and pic3 != ''">#{pic3},</if>
         </trim>
    </insert>
 
    <insert id="insertHoleBiaoguanList" parameterType="java.util.List">
        insert into js_hole_biaoguan
            (ids,code, project_id, hole_id, drill_length, begin1, end1, blow1, begin2, end2, blow2, begin3, end3, blow3, begin4, end4, blow4, power_type, type, title, create_time, record_person, description, longitude, latitude, gps_time, is_delete, position, locate_time, reason, pic1, pic2, pic3)
        VALUES
            <foreach collection="list" item="item" separator =",">
                (#{item.ids}, #{item.code}, #{item.projectId},#{item.holeId},#{item.drillLength},#{item.begin1},#{item.end1},#{item.blow1},#{item.begin2},#{item.end2},#{item.blow2},#{item.begin3},#{item.end3},#{item.blow3},#{item.begin4},#{item.end4},#{item.blow4},#{item.powerType},#{item.type},
                #{item.title},#{item.createTime},#{item.recordPerson},#{item.description},#{item.longitude},#{item.latitude},#{item.gpsTime},#{item.isDelete},#{item.position},#{item.locateTime},#{item.reason},#{item.pic1},#{item.pic2},#{item.pic3})
            </foreach >
    </insert>
 
    <update id="updateHoleBiaoguan" parameterType="HoleBiaoguan">
        update js_hole_biaoguan
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="projectId != null  and projectId != ''">project_id = #{projectId},</if>
            <if test="holeId != null  and holeId != ''">hole_id = #{holeId},</if>
            <if test="drillLength != null  and drillLength != ''">drill_length = #{drillLength},</if>
            <if test="begin1 != null  and begin1 != ''">begin1 = #{begin1},</if>
            <if test="end1 != null  and end1 != ''">end1 = #{end1},</if>
            <if test="blow1 != null  and blow1 != ''">blow1 = #{blow1},</if>
            <if test="begin2 != null  and begin2 != ''">begin2 = #{begin2},</if>
            <if test="end2 != null  and end2 != ''">end2 = #{end2},</if>
            <if test="blow2 != null  and blow2 != ''">blow2 = #{blow2},</if>
            <if test="begin3 != null  and begin3 != ''">begin3 = #{begin3},</if>
            <if test="end3 != null  and end3 != ''">end3 = #{end3},</if>
            <if test="blow3 != null  and blow3 != ''">blow3 = #{blow3},</if>
            <if test="begin4 != null  and begin4 != ''">begin4 = #{begin4},</if>
            <if test="end4 != null  and end4 != ''">end4 = #{end4},</if>
            <if test="blow4 != null  and blow4 != ''">blow4 = #{blow4},</if>
            <if test="powerType != null  and powerType != ''">power_type = #{powerType},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
            <if test="title != null  and title != ''">title = #{title},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="recordPerson != null  and recordPerson != ''">record_person = #{recordPerson},</if>
            <if test="description != null  and description != ''">description = #{description},</if>
            <if test="longitude != null ">longitude = #{longitude},</if>
            <if test="latitude != null ">latitude = #{latitude},</if>
            <if test="gpsTime != null ">gps_time = #{gpsTime},</if>
            <if test="isDelete != null  and isDelete != ''">is_delete = #{isDelete},</if>
            <if test="position != null  and position != ''">position = #{position},</if>
            <if test="locateTime != null ">locate_time = #{locateTime},</if>
            <if test="reason != null  and reason != ''">reason = #{reason},</if>
            <if test="pic1 != null  and pic1 != ''">pic1 = #{pic1},</if>
            <if test="pic2 != null  and pic2 != ''">pic2 = #{pic2},</if>
            <if test="pic3 != null  and pic3 != ''">pic3 = #{pic3},</if>
        </trim>
        where ids = #{ids}
    </update>
 
    <delete id="deleteHoleBiaoguanById" parameterType="String">
        delete from js_hole_biaoguan where ids = #{ids}
    </delete>
 
    <delete id="deleteHoleBiaoguanByIds" parameterType="String">
        delete from js_hole_biaoguan where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>