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
| <?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="cn.gistack.sm.resDataCheck.mapper.QualityManageDetailMapper">
|
|
| <insert id="saveQualityManageDetail">
|
| insert into
| SM_RES_DATA_QUALITY_MANAGE_DETAIL
| (
| res_id,rule_id,rule_name,rule_description,create_time,update_time,val,
| is_gate,eng_scal,is_danger,town_code,town_name,county_code,county_name,city_code,city_name,
| res_reg_code,res_name,rz,tb_weir_top_elevation,tb_norm_pool_stag,tb_control_z,tb_des_fl_stag,tb_dam_top_elevation,tb_dead_stag,remark
| )
| select
| distinct
| a."guid" as res_id,
| ${rule.id} AS rule_id,
| ${rule.name}AS rule_name,
| ${rule.description}AS rule_description,
| NOW() AS create_time,
| NOW() AS update_time,
| ${varStr},
| a."is_gate" AS is_gate,
| a."eng_scal" AS eng_scal,
| dria."is_danger_res" AS is_danger,
|
| case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS town_code,
| case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS town_name,
|
| case when town."ad_grad" = 3 THEN town."ad_code"
| when county."ad_grad" = 3 THEN county."ad_code" END AS county_code,
|
| case when town."ad_grad" = 3 THEN town."ad_name"
| when county."ad_grad" = 3 THEN county."ad_name" END AS county_name,
|
| case when town."ad_grad" = 2 THEN town."ad_code"
| when county."ad_grad" = 2 THEN county."ad_code"
| ELSE city."ad_code" END AS city_code,
|
| case when town."ad_grad" = 2 THEN town."ad_name"
| when county."ad_grad" = 2 THEN county."ad_name"
| ELSE city."ad_name" END AS city_name,
|
| a."res_reg_code" as res_reg_code,
| a."name" as res_name,
| f."rz" as rz,
| g."tb_weir_top_elevation",
| c."tb_norm_pool_stag",
| b."tb_control_z",
| c."tb_des_fl_stag",
| h."tb_dam_top_elevation",
| c."tb_dead_stag",
| ${rule.description} as remark
|
| from SJZT_MD."att_res_base" a
|
| LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = a."interior_ad_guid"
| LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code"
| LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code"
|
| left join SJZT_DW."dim_res_info_a" dria ON (dria."guid" = a."guid")
| left join SJZT_MD."att_res_danger_manage_special" b on (a."guid" = b."res_guid")
| left join SJZT_MD."att_res_stag_char" c on (a."guid" = c."res_guid")
| left join SJZT_MD."att_res_flse_lim" d1 on (a."guid" = d1."res_guid" and d1."flood_season_name" = '前汛期')
| left join SJZT_MD."att_res_flse_lim" d2 on (a."guid" = d2."res_guid" and d2."flood_season_name" = '中汛期')
| left join SJZT_MD."att_res_flse_lim" d3 on (a."guid" = d3."res_guid" and d3."flood_season_name" = '后汛期')
| left join SJZT_MD."att_st_base" e on (a."guid" = e."res_guid" and e."is_main_rsvr" = '1')
| left join SJZT_MD."st_rsvr_r_last" f on (e."code" = f."stcd")
| left join (select tmp."res_guid",max(tmp."tb_weir_top_elevation") "tb_weir_top_elevation" from SJZT_MD."att_res_rsb_norspi" tmp group by tmp."res_guid") g on (a."guid" = g."res_guid")
| left join (select tmp2."res_guid",max(tmp2."tb_dam_top_elevation") "tb_dam_top_elevation" from SJZT_MD."att_res_water_block" tmp2 group by tmp2."res_guid") h on (a."guid" = h."res_guid")
| ${whereStr}
| </insert>
|
|
|
|
| <select id="selectCustomizePage" resultType="cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO">
| SELECT
| RES_ID,
| is_gate,
| eng_scal,
| is_danger,
| town_code,
| town_name,
| county_code,
| county_name,
| city_code,
| city_name,
| res_reg_code,
| res_name,
| rz,
| tb_weir_top_elevation,
| tb_norm_pool_stag,
| tb_control_z,
| tb_des_fl_stag,
| tb_dam_top_elevation,
| tb_dead_stag,
| replace(wm_concat(remark),',',';') as remark
| from YWXT.SM_RES_DATA_QUALITY_MANAGE_DETAIL
| where
| 1=1
| <if test="vo.resId != null and vo.resId != ''">
| res_id = #{vo.resId}
| </if>
| <if test="vo.resName != null and vo.resName != ''">
| res_name LIKE CONCAT('%', #{vo.resName},'%')
| </if>
| <if test="vo.startTime != null and vo.startTime != ''">
| AND DATE_FORMAT(create_time,'%Y-%m-%d') >= #{vo.startTime}
| </if>
| <if test="vo.endTime != null and vo.endTime !='' ">
| AND DATE_FORMAT(create_time,'%Y-%m-%d') <= #{vo.endTime}
| </if>
| <if test="vo.engScal != null and vo.engScal != ''">
| eng_scal = #{vo.engScal}
| </if>
| <if test="vo.cityCode != null and vo.cityCode != ''">
| city_code = #{vo.cityCode}
| </if>
| <if test="vo.countyCode != null and vo.countyCode != ''">
| county_code = #{vo.countyCode}
| </if>
| <if test="vo.townCode != null and vo.townCode != ''">
| town_code= #{vo.townCode}
| </if>
| GROUP BY
| RES_ID,
| is_gate,
| eng_scal,
| is_danger,
| town_code,
| town_name,
| county_code,
| county_name,
| city_code,
| city_name,
| res_reg_code,
| res_name,
| rz,
| tb_weir_top_elevation,
| tb_norm_pool_stag,
| tb_control_z,
| tb_des_fl_stag,
| tb_dam_top_elevation,
| tb_dead_stag
| </select>
| </mapper>
|
|