|
|
@ -26,6 +26,9 @@ |
|
|
|
FROM |
|
|
|
ic_place_org a |
|
|
|
LEFT JOIN customer_grid b ON a.GRID_ID = b.ID |
|
|
|
<if test="null != danger"> |
|
|
|
LEFT JOIN ic_place_patrol_record ppr ON ppr.PLACE_ORG_ID = a.ID |
|
|
|
</if> |
|
|
|
WHERE |
|
|
|
a.del_flag = '0' |
|
|
|
<if test="placeOrgId != null and placeOrgId.trim() != ''"> |
|
|
@ -52,6 +55,17 @@ |
|
|
|
<if test="scale != null and scale.trim() != ''"> |
|
|
|
AND a.scale = #{scale} |
|
|
|
</if> |
|
|
|
<if test="securityFlag != null and securityFlag == true"> |
|
|
|
AND a.SECURITY_FLAG = #{securityFlag} |
|
|
|
</if> |
|
|
|
<if test="null != danger"> |
|
|
|
<if test="danger == 1"> |
|
|
|
AND ppr.FIRST_RESULT = 1 |
|
|
|
</if> |
|
|
|
<if test="danger == 0"> |
|
|
|
AND ppr.FINAL_RESULT = 0 |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
ORDER BY a.created_time DESC |
|
|
|
</select> |
|
|
|
|
|
|
@ -101,8 +115,8 @@ |
|
|
|
( |
|
|
|
SELECT |
|
|
|
count(r.id) as ridCount, |
|
|
|
sum(case when r.FIRST_RESULT = 1 then 1 else 0 end) as dangerCount, |
|
|
|
sum(case when r.FINAL_RESULT = 0 then 1 else 0 end) as removeCount |
|
|
|
sum(case when r.FINAL_RESULT = 1 then 1 else 0 end) as dangerCount, |
|
|
|
sum(case when (r.FINAL_RESULT = 0 and r.FINAL_RESULT = 0) then 1 else 0 end) as removeCount |
|
|
|
FROM |
|
|
|
ic_place_patrol_record r |
|
|
|
<where> |
|
|
@ -150,9 +164,15 @@ |
|
|
|
AND p.id IN ( |
|
|
|
SELECT r.PLACE_ORG_ID FROM ic_place_patrol_record r |
|
|
|
<where> |
|
|
|
r.FINAL_RESULT = 1 and r.DEL_FLAG = 0 |
|
|
|
r.DEL_FLAG = 0 |
|
|
|
<if test="null != danger and danger == 0"> |
|
|
|
AND r.FINAL_RESULT = 0 |
|
|
|
</if> |
|
|
|
<if test="null != danger and danger == 1"> |
|
|
|
AND r.FIRST_RESULT = 1 |
|
|
|
</if> |
|
|
|
<if test="null != orgType and orgType !=''"> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'agancy'"> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'agency'"> |
|
|
|
AND r.agency_id = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'grid'"> |
|
|
@ -160,9 +180,10 @@ |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY r.PLACE_ORG_ID |
|
|
|
) |
|
|
|
<if test="null != orgType and orgType !=''"> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'agancy'"> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'agency'"> |
|
|
|
AND p.agency_id = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="null != orgId and orgId != '' and orgType == 'grid'"> |
|
|
@ -170,7 +191,7 @@ |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
|
|
|
|
GROUP BY p.id |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|