地质所 沉降监测网建设项目
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
<?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.HoleQutuMapper">
    
    <resultMap type="HoleQutu" id="HoleQutuResult">
        <result property="ids"    column="ids"    />
        <result property="code"    column="code"    />
        <result property="projectId"    column="project_id"    />
        <result property="holeId"    column="hole_id"    />
        <result property="beginDepth"    column="begin_depth"    />
        <result property="endDepth"    column="end_depth"    />
        <result property="earthType"    column="earth_type"    />
        <result property="getMode"    column="get_mode"    />
        <result property="testType"    column="test_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="selectHoleQutuVo">
        select ids,code, project_id, hole_id, begin_depth, end_depth, earth_type, get_mode, test_type, title, create_time, record_person, description, longitude, latitude, gps_time, is_delete, position, locate_time, reason, pic1, pic2, pic3 from js_hole_qutu
    </sql>
 
    <select id="selectHoleQutuList" parameterType="HoleQutu" resultMap="HoleQutuResult">
        select
        a.ids,
        a.code,
        a.project_id,
        a.hole_id,
        a.begin_depth,
        a.end_depth,
        a.earth_type,
        a.get_mode,
        a.test_type,
        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_qutu 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="beginDepth != null  and beginDepth != ''"> a.and begin_depth = #{beginDepth}</if>
            <if test="endDepth != null  and endDepth != ''"> and a.end_depth = #{endDepth}</if>
            <if test="earthType != null  and earthType != ''"> a.and earth_type = #{earthType}</if>
            <if test="getMode != null  and getMode != ''"> and a.get_mode = #{getMode}</if>
            <if test="testType != null  and testType != ''"> a.and test_type = #{testType}</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 a.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="selectHoleQutuById" parameterType="String" resultMap="HoleQutuResult">
        select
        a.ids,
        a.code,
        a.project_id,
        a.hole_id,
        a.begin_depth,
        a.end_depth,
        a.earth_type,
        a.get_mode,
        a.test_type,
        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_qutu a LEFT JOIN js_company_user u ON a.record_person = u.ids
        where a.ids = #{ids}
    </select>
 
    <select id="selectHoleQutuByHoleId" parameterType="String" resultMap="HoleQutuResult">
        <include refid="selectHoleQutuVo"/> WHERE hole_id = #{holeId}
    </select>
 
    <select id="selectHoleQutuByProjectId" parameterType="String" resultMap="HoleQutuResult">
        <include refid="selectHoleQutuVo"/> project_id = #{projectId}
    </select>
 
    <insert id="insertHoleQutu" parameterType="HoleQutu">
        insert into js_hole_qutu
        <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="beginDepth != null  and beginDepth != ''">begin_depth,</if>
            <if test="endDepth != null  and endDepth != ''">end_depth,</if>
            <if test="earthType != null  and earthType != ''">earth_type,</if>
            <if test="getMode != null  and getMode != ''">get_mode,</if>
            <if test="testType != null  and testType != ''">test_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="beginDepth != null  and beginDepth != ''">#{beginDepth},</if>
            <if test="endDepth != null  and endDepth != ''">#{endDepth},</if>
            <if test="earthType != null  and earthType != ''">#{earthType},</if>
            <if test="getMode != null  and getMode != ''">#{getMode},</if>
            <if test="testType != null  and testType != ''">#{testType},</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="insertHoleQutuList" parameterType="java.util.List">
        insert into js_hole_qutu
            (ids,code, project_id, hole_id, begin_depth, end_depth, earth_type, get_mode, test_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.beginDepth},#{item.endDepth},#{item.earthType},#{item.getMode},#{item.testType},#{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="updateHoleQutu" parameterType="HoleQutu">
        update js_hole_qutu
        <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="beginDepth != null  and beginDepth != ''">begin_depth = #{beginDepth},</if>
            <if test="endDepth != null  and endDepth != ''">end_depth = #{endDepth},</if>
            <if test="earthType != null  and earthType != ''">earth_type = #{earthType},</if>
            <if test="getMode != null  and getMode != ''">get_mode = #{getMode},</if>
            <if test="testType != null  and testType != ''">test_type = #{testType},</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="deleteHoleQutuById" parameterType="String">
        delete from js_hole_qutu where ids = #{ids}
    </delete>
 
    <delete id="deleteHoleQutuByIds" parameterType="String">
        delete from js_hole_qutu where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>