13693261870
2025-06-24 8565bd83fcd670ec8379084d600eb97d18037d21
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<?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.lf.server.mapper.sys.ReportMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_report
        <where>
            <if test="name != null">
                upper(name) like #{name}
            </if>
            <if test="code != null">
                code = #{code}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="com.lf.server.entity.sys.ReportEntity">
        select a.*,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName from lf.sys_report a
        <where>
            <if test="name != null">
                upper(name) like #{name}
            </if>
            <if test="code != null">
                code = #{code}
            </if>
        </where>
        order by a.id desc
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAll" resultType="com.lf.server.entity.sys.ReportEntity">
        select * from lf.sys_report order by id desc;
    </select>
 
    <select id="selectById" resultType="com.lf.server.entity.sys.ReportEntity">
        select * from lf.sys_report where id = #{id}
    </select>
 
    <insert id="insert" parameterType="com.lf.server.entity.sys.ReportEntity">
        insert into lf.sys_report
        (name,type,fname,guid,code,create_user,create_time,bak)
        values
        (#{name},#{type},#{fname},#{guid},#{code},#{createUser},now(),#{bak})
    </insert>
 
    <insert id="inserts">
        insert into lf.sys_report
        (name,type,fname,guid,code,create_user,create_time,bak)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.name},#{item.type},#{item.fname},#{item.guid},#{item.code},#{item.createUser},now(),#{item.bak})
        </foreach>
    </insert>
 
    <delete id="delete">
        delete from lf.sys_report where id = #{id}
    </delete>
 
    <delete id="deletes">
        delete from lf.sys_report where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="update">
        update lf.sys_report
        set name=#{name},type=#{type},fname=#{fname},guid=#{guid},code=#{code},update_user=#{updateUser},update_time=now(),bak=#{bak}
        where id=#{id}
    </update>
 
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_report
            <set>
                name=#{item.name},type=#{item.type},fname=#{item.fname},guid=#{item.guid},code=#{item.code},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak}
            </set>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!-- 数据量统计 -->
    <select id="countSizes" resultType="com.lf.server.entity.ctrl.CountEntity">
        select fn_get_fullname(depcode, 1) "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count"
        from lf.sys_meta
        group by depcode
        order by depcode;
    </select>
 
    <!-- 按文件类型统计 -->
    <select id="countSizesByType" resultType="com.lf.server.entity.ctrl.CountEntity">
        select type "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count"
        from lf.sys_meta
        group by type
        order by type;
    </select>
 
    <!-- 服务调用量统计 -->
    <select id="countServices" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1", count(*) "count"
        from lf.sys_serve_log
        group by name
        order by name;
    </select>
 
    <!-- 用户流量统计 -->
    <select id="countOperates" resultType="com.lf.server.entity.ctrl.CountEntity">
        select modular1 "m1", modular2 "m2", count(*) "count"
        from lf.sys_operate
        group by modular1,modular2
        order by modular1 desc,modular2;
    </select>
 
    <!-- 按项目统计数据 -->
    <select id="countSizesByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(sizes), 0) as decimal(18, 3) ) from lf.sys_meta b where b.dircode like a.code || '%') as  "sizes",
          (select count(*) from lf.sys_meta b where b.dircode like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by a.code;
    </select>
 
    <!-- 按项目统计钻孔数据 -->
    <select id="countExplorationPoints" resultType="com.lf.server.entity.ctrl.CountEntity">
        select
            name "m1", a.code "m3", 0.0 "area",
            (select count(*) from bs.s_explorationpoint b where dirid like a.code || '%') "count",
            (select coalesce(round(sum(sizes)::numeric, 3), 0)
                from bs.s_explorationpoint b
                inner join lf.sys_meta c
                on b.parentid = c.eventid
                where b.dirid like a.code || '%') "sizes"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 根据项目编码查询钻孔数据坐标点 -->
    <select id="selectExplorationPoints" resultType="com.lf.server.entity.ctrl.CoordinateEntity">
        select ST_X(geom) "x", ST_Y(geom) "y"
        from bs.s_explorationpoint b
        <where>
            dirid like #{code} and geom is not null
        </where>
    </select>
 
    <!-- 按项目统计数字高程模型面积 -->
    <select id="countDemAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) from lf.sys_meta b
           inner join lf.sys_dir c on b.dircode = c.code
           where c.name = '数字高程模型' and b.type in ('dem', 'tif', 'tiff') and b.dircode like a.code || '%') "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计三维地形模型面积:mpt -->
    <select id="countMptAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1", 0.0 "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计倾斜摄影模型面积:osgb -->
    <select id="countOsgbAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(area), 0) as decimal(20, 2) ) from lf.sys_meta b
           where b.type = 'osgb' and b.dircode like a.code || '%') "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计激光点云模型面积:las,laz -->
    <select id="countLasAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(area), 0) as decimal(20, 2) ) from lf.sys_meta b
           where b.type in ('las', 'laz') and b.dircode like a.code || '%') "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计勘察工点个数 -->
    <select id="countSurveyWorksiteByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.s_surveyworksite b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计勘察报告个数 -->
    <select id="countExplorationReportByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.s_explorationpoint b
           inner join lf.sys_attach c on b.eventid = c.tab_guid
           where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计崩塌个数 -->
    <select id="countCollapseByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_collapse b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计泥石流个数 -->
    <select id="countDebrisFlowByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_debrisflow b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计地面塌陷个数 -->
    <select id="countGroundCollapseByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_ground_collapse b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计高陡边坡个数 -->
    <select id="countHighSteepSlopeByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_highandsteep_slope b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计滑坡个数 -->
    <select id="countLandSlideByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_landslide b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计不稳定斜坡个数 -->
    <select id="countUnstableSlopeByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_unstable_slope b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计水毁个数 -->
    <select id="countWaterDamageByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.g_water_damage b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 统计数字线划图面积 -->
    <select id="countDlgAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select dir "m1", cast( coalesce(sum(area), 0) as decimal(20, 2) ) "area"
        from lf.sys_line_buffer
        group by code, dir
        order by code;
    </select>
 
    <!-- 按项目统计数字正射影像图面积 -->
    <select id="countDomAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) from lf.sys_meta b
           inner join lf.sys_dir c on b.dircode = c.code
           where c.name = '数字正射影像图' and b.type in ('img', 'tif', 'tiff') and b.dircode like a.code || '%') "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计管线长度 -->
    <select id="countLineLength" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) )
           from bs.m_pipeline b where b.dirid like a.code || '%') as  "len"
        from lf.sys_dir a
        where pid = 0
        order by a.code;
    </select>
 
    <!-- 按项目统计勘探点个数 -->
    <select id="countExplorationPointByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bs.s_explorationpoint b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计三维地质模型面积 -->
    <select id="countGeoModelAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) )
           from lf.sys_meta b where b.type in ('fbx', 'ifc') and b.dircode like a.code || '%') "area"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 按项目统计地灾点个数 -->
    <select id="countGeologicHazardByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        select name "m1",
          (select count(*) from bd.b_geologic_hazard b where b.dirid like a.code || '%') "count"
        from lf.sys_dir a
        where pid = 0
        order by code;
    </select>
 
    <!-- 项目数据分类统计 -->
    <select id="countVariousDataByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
        (select '数字线划图' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_line_buffer
            <where>
                <if test="null != code">
                    code like #{code}
                </if>
            </where>
        )
        union all
        (select '数字高程模型' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code
            <where>
                c.name = '数字高程模型' and b.type in ('dem', 'tif', 'tiff')
                <if test="null != code">
                    and b.dircode like #{code}
                </if>
            </where>
        )
        union all
        (select '数字正射影像图' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code
            <where>
                c.name = '数字正射影像图' and b.type in ('img', 'tif', 'tiff')
                <if test="null != code">
                    and b.dircode like #{code}
                </if>
            </where>
        )
        union all
        (select '倾斜摄影模型' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_meta b
            <where>
                b.type = 'osgb'
                <if test="null != code">
                    and b.dircode like #{code}
                </if>
            </where>
        )
        union all
        (select '激光点云模型' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
            from lf.sys_meta b
            <where>
                b.type in ('las', 'laz')
                <if test="null != code">
                    and b.dircode like #{code}
                </if>
            </where>
        )
        union all
        (select '管线长度' "m1", 'len' "m2", 0 "count", 0 "area",
                cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) ) "len"
            from bs.m_pipeline b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '勘探点' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '勘察工点' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_surveyworksite b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '勘察报告' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b
            inner join lf.sys_attach c on b.eventid = c.tab_guid
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '三维地质模型' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" from lf.sys_meta b
            <where>
                b.type in ('fbx', 'ifc')
                <if test="null != code">
                    and b.dircode like #{code}
                </if>
            </where>
        )
        union all
        (select '地灾点' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bd.b_geologic_hazard b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '崩塌' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_collapse b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '泥石流' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_debrisflow b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '地面塌陷' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_ground_collapse b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '高陡边坡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_highandsteep_slope b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '滑坡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_landslide b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '不稳定斜坡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_unstable_slope b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        )
        union all
        (select '水毁' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_water_damage b
            <where>
                <if test="null != code">
                    b.dirid like #{code}
                </if>
            </where>
        );
    </select>
</mapper>