地质所 沉降监测网建设项目
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
<?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.HoleShuiweiMapper">
    
    <resultMap type="HoleShuiwei" id="HoleShuiweiResult">
        <result property="ids"    column="ids"    />
         <result property="code"    column="code"    />
        <result property="projectId"    column="project_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="type"    column="type"    />
        <result property="waterType"    column="water_type"    />
        <result property="shownWaterLevel"    column="shown_water_level"    />
        <result property="stillWaterLevel"    column="still_water_level"    />
        <result property="shownTime"    column="shown_time"    />
        <result property="stillTime"    column="still_time"    />
        <result property="waterDepth"    column="water_depth"    />
        <result property="getMode"    column="get_mode"    />
        <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="selectHoleShuiweiVo">
        select ids,code, project_id, hole_id, type, water_type, shown_water_level, still_water_level, shown_time, still_time, water_depth, get_mode, title, create_time, record_person, description, longitude, latitude, gps_time, is_delete, position, locate_time, reason, pic1, pic2, pic3 from js_hole_shuiwei
    </sql>
 
    <select id="selectHoleShuiweiList" parameterType="HoleShuiwei" resultMap="HoleShuiweiResult">
        select
        a.ids,
        a.code,
        a.project_id,
        a.hole_id,
        a.type,
        a.water_type,
        a.shown_water_level,
        a.still_water_level,
        a.shown_time,
        a.still_time,
        a.water_depth,
        a.get_mode,
        a.title,
        a.create_time,
        a.record_person,
        u.real_name AS record_person_name,
        a.description,
        a.longitude,
        a.latitude,
        a.gps_time,
        a.is_delete,
        a.position,
        a.locate_time,
        a.reason,
        a.pic1,
        a.pic2,
        a. pic3
        from js_hole_shuiwei a LEFT JOIN js_company_user u ON a.record_person = u.ids
        <where>
            <if test="code != null  and code != ''"> and a.code = #{code}</if>
            <if test="projectId != null  and projectId != ''"> and a.project_id = #{projectId}</if>
            <if test="holeId != null  and holeId != ''"> and a.hole_id = #{holeId}</if>
            <if test="type != null  and type != ''"> and a.type = #{type}</if>
            <if test="waterType != null  and waterType != ''"> and a.water_type = #{waterType}</if>
            <if test="shownWaterLevel != null "> and a.shown_water_level = #{shownWaterLevel}</if>
            <if test="stillWaterLevel != null "> and a.still_water_level = #{stillWaterLevel}</if>
            <if test="shownTime != null  and shownTime != ''"> and a.shown_time = #{shownTime}</if>
            <if test="stillTime != null  and stillTime != ''"> and a.still_time = #{stillTime}</if>
            <if test="waterDepth != null "> and a.water_depth = #{waterDepth}</if>
            <if test="getMode != null  and getMode != ''"> and a.get_mode = #{getMode}</if>
            <if test="title != null  and title != ''"> and a.title = #{title}</if>
            <if test="recordPerson != null  and recordPerson != ''"> and a.record_person = #{recordPerson}</if>
            <if test="description != null  and description != ''"> and a.description = #{description}</if>
            <if test="longitude != null "> and a.longitude = #{longitude}</if>
            <if test="latitude != null "> and a.latitude = #{latitude}</if>
            <if test="gpsTime != null "> and a.gps_time = #{gpsTime}</if>
            <if test="isDelete != null  and isDelete != ''"> and a.is_delete = #{isDelete}</if>
            <if test="position != null  and position != ''"> and a.position = #{position}</if>
            <if test="locateTime != null "> and a.locate_time = #{locateTime}</if>
            <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
            <if test="pic1 != null  and pic1 != ''"> and a.pic1 = #{pic1}</if>
            <if test="pic2 != null  and pic2 != ''"> and a.pic2 = #{pic2}</if>
            <if test="pic3 != null  and pic3 != ''"> and a.pic3 = #{pic3}</if>
        </where>
        ORDER BY a.code ASC
    </select>
    
    <select id="selectHoleShuiweiById" parameterType="String" resultMap="HoleShuiweiResult">
        select
        a.ids,
        a.code,
        a.project_id,
        a.hole_id,
        a.type,
        a.water_type,
        a.shown_water_level,
        a.still_water_level,
        a.shown_time,
        a.still_time,
        a.water_depth,
        a.get_mode,
        a.title,
        a.create_time,
        a.record_person,
        a.description,
        a.longitude,
        a.latitude,
        a.gps_time,
        a.is_delete,
        a.position,
        a.locate_time,
        a.reason,
        a.pic1,
        a.pic2,
        a. pic3
        from js_hole_shuiwei a LEFT JOIN js_company_user u ON a.record_person = u.ids
        where a.ids = #{ids}
    </select>
 
    <select id="countNumberByProjectId" resultType="java.lang.Long">
        SELECT count(ids) FROM js_hole_shuiwei where project_id = #{projectId} AND type = #{type}
    </select>
    <select id="selectHoleShuiWeiByHoleId" parameterType="String" resultMap="HoleShuiweiResult">
        <include refid="selectHoleShuiweiVo"/> where hole_id = #{holeId}
    </select>
 
    <select id="selectHoleShuiWeiByProjectId" resultType="com.javaweb.geo.domain.HoleShuiwei">
        <include refid="selectHoleShuiweiVo"/> WHERE project_id = #{projectId}
    </select>
 
    <insert id="insertHoleShuiwei" parameterType="HoleShuiwei">
        insert into js_hole_shuiwei
        <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="type != null  and type != ''">type,</if>
            <if test="waterType != null  and waterType != ''">water_type,</if>
            <if test="shownWaterLevel != null ">shown_water_level,</if>
            <if test="stillWaterLevel != null ">still_water_level,</if>
            <if test="shownTime != null  and shownTime != ''">shown_time,</if>
            <if test="stillTime != null  and stillTime != ''">still_time,</if>
            <if test="waterDepth != null ">water_depth,</if>
            <if test="getMode != null  and getMode != ''">get_mode,</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="type != null  and type != ''">#{type},</if>
            <if test="waterType != null  and waterType != ''">#{waterType},</if>
            <if test="shownWaterLevel != null ">#{shownWaterLevel},</if>
            <if test="stillWaterLevel != null ">#{stillWaterLevel},</if>
            <if test="shownTime != null  and shownTime != ''">#{shownTime},</if>
            <if test="stillTime != null  and stillTime != ''">#{stillTime},</if>
            <if test="waterDepth != null ">#{waterDepth},</if>
            <if test="getMode != null  and getMode != ''">#{getMode},</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="insertHoleShuiweiList" parameterType="java.util.List">
        insert into js_hole_shuiwei
            (ids,code, project_id, hole_id, type, water_type, shown_water_level, still_water_level, shown_time, still_time, water_depth, get_mode, 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.type},#{item.waterType},#{item.shownWaterLevel},#{item.stillWaterLevel},#{item.shownTime},#{item.stillTime},#{item.waterDepth},#{item.getMode},
            #{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="updateHoleShuiwei" parameterType="HoleShuiwei">
        update js_hole_shuiwei
        <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="type != null  and type != ''">type = #{type},</if>
            <if test="waterType != null  and waterType != ''">water_type = #{waterType},</if>
            <if test="shownWaterLevel != null ">shown_water_level = #{shownWaterLevel},</if>
            <if test="stillWaterLevel != null ">still_water_level = #{stillWaterLevel},</if>
            <if test="shownTime != null  and shownTime != ''">shown_time = #{shownTime},</if>
            <if test="stillTime != null  and stillTime != ''">still_time = #{stillTime},</if>
            <if test="waterDepth != null ">water_depth = #{waterDepth},</if>
            <if test="getMode != null  and getMode != ''">get_mode = #{getMode},</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="deleteHoleShuiweiById" parameterType="String">
        delete from js_hole_shuiwei where ids = #{ids}
    </delete>
 
    <delete id="deleteHoleShuiweiByIds" parameterType="String">
        delete from js_hole_shuiwei where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>