| | |
| | | FROM( |
| | | SELECT |
| | | COUNT(*) totalNum, |
| | | SUM(CASE WHEN (trgis."check_state" = 1 or trgis."check_state" = 2) THEN 1 ELSE 0 END) as finishNum |
| | | SUM(CASE WHEN (trgis."check_state" = 3) THEN 1 ELSE 0 END) as finishNum |
| | | from |
| | | <include refid="resBase"/> |
| | | LEFT JOIN SJZT_MD."tb_res_general_investigation_state" trgis ON trgis."res_guid" = arb."code" AND (trgis."check_state" = 1 or trgis."check_state" = 2) |
| | | LEFT JOIN SJZT_MD."tb_res_general_investigation_state" trgis ON trgis."res_guid" = arb."code" AND (trgis."check_state" = 3) |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | AND trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | |
| | | LEFT JOIN YWXT."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" province ON province."ad_code" = city."p_ad_code" |
| | | where (town."ad_code" = aab."guid" or county."ad_code" = aab."guid" or city."ad_code" = aab."guid" or province."ad_code" = aab."guid") |
| | | <!--控制只有待审核和已审核数据才显示--> |
| | | and (trgis."check_state" = 1 or trgis."check_state" = 2) |
| | | <!--只有已审核数据才显示--> |
| | | and (trgis."check_state" = 3 and totalDangerNum > 0) |
| | | ) |
| | | ) dangerNum |
| | | FROM YWXT."att_ad_base" aab |
| | |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and trgis."check_state" = 1 |
| | | and (trgis."check_state" > 1) |
| | | )investigationResNum, |
| | | ( |
| | | SELECT COUNT(*) FROM |
| | |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and trgis."check_state" = 2 |
| | | and trgis."check_state" = 3 |
| | | )checkResNum, |
| | | ( |
| | | SELECT COUNT(*) FROM |
| | | ( |
| | | select trgis.*,trgi.dangerNum from SJZT_MD."tb_res_general_investigation_state" trgis |
| | | left join ( |
| | | select * from ( |
| | | select "tb_state_id",count(*) dangerNum from SJZT_MD."tb_res_general_investigation" |
| | | where "hazard_rating" = '有危害' group by "tb_state_id" |
| | | ) |
| | | ) trgi on trgi."tb_state_id" = trgis."guid" |
| | | ) trgis |
| | | left join SJZT_MD."tb_res_general_investigation" trgi on trgi."tb_state_id" = trgis."res_guid" and trgi."hazard_rating" = '有危害' |
| | | LEFT JOIN sjzt_MD."att_res_base" ARB ON ARB."code" = trgis."res_guid" |
| | | LEFT JOIN YWXT."att_ad_base" town ON town."ad_code" = arb."interior_ad_guid" |
| | | LEFT JOIN YWXT."att_ad_base" county ON county."ad_code" = town."p_ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" province ON province."ad_code" = city."p_ad_code" |
| | | where 1=1 |
| | | and (town."ad_code" = aab."guid" or county."ad_code" = aab."guid" or city."ad_code" = aab."guid" or province."ad_code" = aab."guid") |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and trgis."check_state" = 3 and trgis.dangerNum is not null |
| | | )resMayiNum, |
| | | ( |
| | | SELECT COUNT(*) |
| | | FROM SJZT_MD."tb_res_dyke" trd |
| | |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and tdis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and tdis."check_state" = 1 |
| | | and (tdis."check_state" = 1 or tdis."check_state" = 2 or tdis."check_state" = 3) |
| | | )investigationDykeNum, |
| | | ( |
| | | SELECT COUNT(*) FROM |
| | |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and tdis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and tdis."check_state" = 2 |
| | | and (tdis."check_state" = 2 or tdis."check_state" = 3) |
| | | )checkDykeNum, |
| | | IFNULL( |
| | | ( |
| | | SELECT SUM(CASE WHEN trd."dyke_length" THEN trd."dyke_length" ELSE 0 END) FROM ( |
| | | SELECT TRD.* FROM SJZT_MD."tb_dyke_investigation_state" tdis |
| | | LEFT JOIN SJZT_MD."tb_res_dyke" trd on (trd."guid" = tdis."dyke_guid") |
| | | <where> |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | and tdis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | and tdis."check_state" >= 2 |
| | | </where> |
| | | ) trd |
| | | LEFT JOIN ywxt."att_ad_base" county on county."ad_code" = trd."ad_code" |
| | | LEFT JOIN ywxt."att_ad_base" city on city."ad_code" = county."p_ad_code" |
| | | LEFT JOIN ywxt."att_ad_base" province on province."ad_code" = city."p_ad_code" |
| | | where (county."ad_code" = aab."guid" or city."ad_code" = aab."guid" or province."ad_code" = aab."guid") |
| | | ),0 |
| | | ) AS tbDykeLength, |
| | | IFNULL( |
| | | ( |
| | | SELECT |
| | |
| | | SELECT |
| | | TEMP1."tb_state_id", |
| | | TEMP1."unit", |
| | | TEMP1.dangerLength/temp1.num as dangerLength |
| | | TEMP1.dangerLength as dangerLength |
| | | FROM ( |
| | | SELECT |
| | | tdi."tb_state_id", |
| | |
| | | group by tdi."tb_state_id",tdi."dyke_guid",tdi."unit" |
| | | )TEMP1 |
| | | ) tdi on tdi."tb_state_id" = tdis."guid" |
| | | where (tdis."check_state" = 1 or tdis."check_state" = 2) |
| | | where (tdis."check_state" = 3) |
| | | ) trd |
| | | LEFT JOIN YWXT."att_ad_base" county ON county."ad_code" = trd."ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | |
| | | order by aab."guid" |
| | | </select> |
| | | |
| | | <select id="getIamgeAndVideoUrl" resultType="cn.gistack.sm.sjztmd.vo.ImageAndVideoVO"> |
| | | select "res_name","image_urls" as imagesUrl ,"video_urls" as videosUrl from sjzt_md."tb_res_general_investigation" |
| | | </select> |
| | | <select id="getIamgeAndVideoUrlcopy" resultType="cn.gistack.sm.sjztmd.vo.ResGentionVO"> |
| | | select resgi."res_name" resname,resgi."res_guid" code,resgi."part_place" ppname ,regis."tb_year" years,LPAD(CAST(ROW_NUMBER() OVER (PARTITION BY regis."res_guid" |
| | | ORDER BY |
| | | regis."create_time" DESC)AS VARCHAR(3)),3,'0') AS rn,resgi."image_urls" imagesUrls,resgi."video_urls" videoUrls, |
| | | CASE WHEN town."ad_grad" = '3' THEN |
| | | town."ad_name" |
| | | WHEN county."ad_grad" = '3' THEN |
| | | county."ad_name" |
| | | END AS countyName, |
| | | 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 cityName |
| | | from SJZT_MD."tb_res_general_investigation" resgi |
| | | left join SJZT_MD."tb_res_general_investigation_state" regis on resgi."res_guid" = regis."res_guid" |
| | | left join SJZT_MD."att_res_base" a on resgi."res_guid" = a."code" |
| | | left join ywxt."att_ad_base" town ON town."guid" = a."interior_ad_guid" |
| | | left join ywxt."att_ad_base" county ON town."p_ad_code" = county."ad_code" |
| | | left join ywxt."att_ad_base" city ON county."p_ad_code" = city."ad_code" |
| | | left join ywxt."att_ad_base" province ON city."p_ad_code" = province."ad_code" |
| | | where regis."check_state" ='3' |
| | | </select> |
| | | |
| | | </mapper> |