| | |
| | | tmp.totalDangerNum, |
| | | tmp.termiteNum, |
| | | tmp.otherNum, |
| | | tmp.totalDangerLength |
| | | tmp.totalDangerLength, |
| | | ifnull(tmp.totalDanger,0) totalDanger, |
| | | ifnull(tmp.totalDangerSr,0) totalDangerSr, |
| | | ifnull(tmp.totalDangerCb,0) totalDangerCb, |
| | | ifnull(tmp.totalDangerDw,0) totalDangerDw |
| | | |
| | | from sjzt_md."tb_res_dyke" trd |
| | | left join "SJZT_MD"."tb_dyke_investigation_state" tdis on trd."guid" = tdis."dyke_guid" |
| | | left join YWXT."att_ad_base" aa on aa."guid" = trd."ad_code" |
| | |
| | | sum(temp2.totalDangerNum) as totalDangerNum, |
| | | sum(temp2.termiteNum) as termiteNum, |
| | | sum(temp2.otherNum) as otherNum, |
| | | SUM(CASE WHEN temp2.dangerLength THEN temp2.dangerLength ELSE 0 END) AS totalDangerLength |
| | | SUM(CASE WHEN temp2.dangerLength THEN temp2.dangerLength ELSE 0 END) AS totalDangerLength, |
| | | sum(temp2.totalDanger) as totalDanger, |
| | | sum(temp2.totalDangerSr) as totalDangerSr, |
| | | sum(temp2.totalDangerCb) as totalDangerCb, |
| | | sum(temp2.totalDangerDw) as totalDangerDw |
| | | from( |
| | | SELECT |
| | | TEMP1.*, |
| | |
| | | SUM(CASE WHEN (tdi."danger_length") THEN tdi."danger_length" ELSE 0 END) AS dangerLength, |
| | | SUM(CASE WHEN (tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS totalDangerNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" = '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS termiteNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" != '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum |
| | | SUM(CASE WHEN (tdi."investigation_variety" != '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum, |
| | | SUM(CASE WHEN (tdi."is_danger" != '否') THEN 1 ELSE 0 END) AS totalDanger, |
| | | SUM(CASE WHEN (json_value(tdi."danger_info", '$.sr') != '') THEN json_value(tdi."danger_info", '$.sr') ELSE 0 END) AS totalDangerSr, |
| | | SUM(CASE WHEN (json_value(tdi."danger_info", '$.cb') != '') THEN json_value(tdi."danger_info", '$.cb') ELSE 0 END) AS totalDangerCb, |
| | | SUM(CASE WHEN (json_value(tdi."danger_info", '$.dw') != '') THEN json_value(tdi."danger_info", '$.dw') ELSE 0 END) AS totalDangerDw |
| | | from sjzt_md."tb_dyke_investigation" tdi |
| | | where 1=1 |
| | | <if test="vo.tbYear !=null and vo.tbYear !=''"> |