| | |
| | | FROM( |
| | | SELECT |
| | | COUNT(*) totalNum, |
| | | SUM(CASE WHEN (trgis."check_state" = 3) THEN 1 ELSE 0 END) as finishNum |
| | | SUM(CASE WHEN (trgis."check_state" >= 2) 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" = 3) |
| | | LEFT JOIN SJZT_MD."tb_res_general_investigation_state" trgis ON trgis."res_guid" = arb."code" AND (trgis."check_state" >= 2) |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | AND trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | |
| | | 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" = 3 and totalDangerNum > 0) |
| | | and (trgis."check_state" >= 2 and totalDangerNum > 0) |
| | | ) |
| | | ) dangerNum |
| | | FROM YWXT."att_ad_base" aab |
| | |
| | | <if test="params.tbQuarter != null and params.tbQuarter !=''"> |
| | | AND trgis."tb_quarter" = #{params.tbQuarter} |
| | | </if> |
| | | and trgis."check_state" = 3 |
| | | and trgis."check_state" >= 2 |
| | | )checkResNum, |
| | | ( |
| | | SELECT COUNT(*) FROM |
| | |
| | | <if test="params.tbQuarter != null and params.tbQuarter !=''"> |
| | | AND trgis."tb_quarter" = #{params.tbQuarter} |
| | | </if> |
| | | and trgis."check_state" = 3 and trgis.dangerNum is not null |
| | | and trgis."check_state" >= 2 and trgis.dangerNum is not null |
| | | )resMayiNum, |
| | | ( |
| | | SELECT COUNT(*) |
| | |
| | | <if test="params.tbQuarter != null and params.tbQuarter !=''"> |
| | | AND tdis."tb_quarter" = #{params.tbQuarter} |
| | | </if> |
| | | and (tdis."check_state" = 1 or tdis."check_state" = 2 or tdis."check_state" = 3) |
| | | and (tdis."check_state" >=1) |
| | | )investigationDykeNum, |
| | | ( |
| | | SELECT COUNT(*) FROM |
| | |
| | | <if test="params.tbQuarter != null and params.tbQuarter !=''"> |
| | | AND tdis."tb_quarter" = #{params.tbQuarter} |
| | | </if> |
| | | and (tdis."check_state" = 2 or tdis."check_state" = 3) |
| | | and (tdis."check_state" >= 2) |
| | | )checkDykeNum, |
| | | IFNULL( |
| | | ( |
| | |
| | | group by tdi."tb_state_id",tdi."dyke_guid",tdi."unit" |
| | | )TEMP1 |
| | | ) tdi on tdi."tb_state_id" = tdis."guid" |
| | | where (tdis."check_state" = 3) |
| | | where (tdis."check_state" >= 2) |
| | | ) 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" |