|
|
@@ -814,45 +814,79 @@ and
|
|
|
|
|
|
</select>
|
|
|
<select id="selectConstructionDetail" resultType="com.xunmei.system.util.ConstructionDetailExport">
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- a.org_id AS orgId,-->
|
|
|
+<!-- IFNULL( b.ownership, 0 ) AS ownership,-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- (-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
|
|
|
+<!-- 1,-->
|
|
|
+<!-- 0-->
|
|
|
+<!-- ) AS complianceStatus,-->
|
|
|
+<!-- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- (-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+-->
|
|
|
+<!-- IF-->
|
|
|
+<!-- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,-->
|
|
|
+<!-- NULL,-->
|
|
|
+<!-- a.reason-->
|
|
|
+<!-- ) AS reason,-->
|
|
|
+<!-- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS completeDate,-->
|
|
|
+<!-- c.address as address,-->
|
|
|
+<!-- c.affiliated_area as city,-->
|
|
|
+<!-- c.affiliated_bank as orgName,-->
|
|
|
+<!-- c.short_name as networkName-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- sys_org c-->
|
|
|
+<!-- LEFT JOIN sys_org_physical_defense_construction a ON c.id=a.org_id-->
|
|
|
+<!-- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id-->
|
|
|
+<!-- WHERE c.type=4-->
|
|
|
+<!-- and c.deleted = 0-->
|
|
|
+<!-- and c.is_lock = 0-->
|
|
|
+<!-- and a.type =1-->
|
|
|
+<!-- and c.path like concat(#{orgPath}, '%')-->
|
|
|
+<!-- GROUP BY-->
|
|
|
+<!-- a.org_id-->
|
|
|
SELECT
|
|
|
- a.org_id AS orgId,
|
|
|
- IFNULL( b.ownership, 0 ) AS ownership,
|
|
|
- IF
|
|
|
- (
|
|
|
- IF
|
|
|
- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
|
|
|
- IF
|
|
|
- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
|
|
|
- 1,
|
|
|
- 0
|
|
|
- ) AS complianceStatus,
|
|
|
- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,
|
|
|
-<!-- a.date_of_compliance AS complianceDate,-->
|
|
|
- IF
|
|
|
- (
|
|
|
- IF
|
|
|
- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
|
|
|
- IF
|
|
|
- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
|
|
|
- NULL,
|
|
|
- a.reason
|
|
|
- ) AS reason,
|
|
|
- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS completeDate,
|
|
|
-<!-- a.date_of_complete AS completeDate,-->
|
|
|
- c.address as address,
|
|
|
- c.affiliated_area as city,
|
|
|
- c.affiliated_bank as orgName,
|
|
|
- c.short_name as networkName
|
|
|
+ c.id AS orgId,
|
|
|
+ IFNULL( b.ownership, 0 ) AS ownership,
|
|
|
+ case when a.banking2021=1 then 2021 when a.banking2015=1 then 2015 when a.unGA38=1 then 1 else 0 end as complianceStatus,
|
|
|
+ IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,
|
|
|
+ IF
|
|
|
+ (
|
|
|
+ a.unGA38=1,
|
|
|
+ a.reason,
|
|
|
+ ''
|
|
|
+ ) AS reason,
|
|
|
+ IF( a.unGA38=1, IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ),'') AS completeDate,
|
|
|
+ c.address as address,
|
|
|
+ c.address as address,
|
|
|
+ c.affiliated_area as city,
|
|
|
+ c.affiliated_bank as orgName,
|
|
|
+ c.short_name as networkName
|
|
|
FROM
|
|
|
- sys_org_physical_defense_construction a
|
|
|
- INNER JOIN sys_org c ON c.id=a.org_id
|
|
|
- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id
|
|
|
+ sys_org c
|
|
|
+ LEFT JOIN (select org_id,date_of_compliance,reason,date_of_complete,
|
|
|
+ banking2021,
|
|
|
+ if(banking2015 > 0 and banking2021 = 0, 1, 0) as banking2015,
|
|
|
+ if(unGA38 >0 and banking2015 = 0 and banking2021 = 0, 1, 0) as unGA38
|
|
|
+ from (SELECT org_id,Max(date_of_compliance) as date_of_compliance,reason,date_of_complete,
|
|
|
+ sum(standard = 1) banking2021,
|
|
|
+ sum(standard = 2) banking2015,
|
|
|
+ sum(standard = 3) unGA38
|
|
|
+ FROM sys_org_physical_defense_construction
|
|
|
+ WHERE type = 1
|
|
|
+ GROUP BY org_id) t1) a ON c.id = a.org_id
|
|
|
+ LEFT JOIN sys_org_extend b ON c.id = b.org_id
|
|
|
WHERE c.type=4
|
|
|
- and c.deleted = 0
|
|
|
- and c.is_lock = 0
|
|
|
- and c.path like concat(#{orgPath}, '%')
|
|
|
- GROUP BY
|
|
|
- a.org_id
|
|
|
+ and c.deleted = 0
|
|
|
+ and c.is_lock = 0
|
|
|
+ and c.path like concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="getReachNumber" resultType="java.lang.Integer">
|
|
|
select SUM(a.size) from (select org_id,if(count(*) > 0,1,0) as size from sys_org_physical_defense_construction where standard in (1,2) and type = 1 GROUP BY org_id) a
|
|
|
@@ -860,6 +894,7 @@ and
|
|
|
where 1=1
|
|
|
AND b.deleted = 0
|
|
|
and b.is_lock = 0
|
|
|
+ and b.type=4
|
|
|
AND b.path LIKE concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="getOwnership" resultType="java.lang.Integer">
|
|
|
@@ -884,19 +919,29 @@ and
|
|
|
</select>
|
|
|
<select id="getLibrary" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- COUNT( a.business_library_type ) AS total,
|
|
|
- IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
|
|
|
- IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
|
|
|
- IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
|
|
|
- IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
|
|
|
+ sum( a.yywd + a.zxywk ) AS total,
|
|
|
+ a.one,
|
|
|
+ a.two,
|
|
|
+ a.three,
|
|
|
+ a.four
|
|
|
FROM
|
|
|
- sys_org_extend a
|
|
|
- LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
- where
|
|
|
- 1=1
|
|
|
- and b.path LIKE concat(#{orgPath}, '%')
|
|
|
- and b.is_lock = 0
|
|
|
- and b.deleted = 0
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ IFNULL( sum( IF ( b.type = 6, 1, 0 )), 0 ) AS yywd,
|
|
|
+ IFNULL( sum( IF ( b.type = 4 AND a.business_library = 1, 1, 0 )), 0 ) AS zxywk,
|
|
|
+ IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
|
|
|
+ IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
|
|
|
+ IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
|
|
|
+ IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
|
|
|
+ FROM
|
|
|
+ sys_org b
|
|
|
+ LEFT JOIN sys_org_extend a ON a.org_id = b.id
|
|
|
+ WHERE
|
|
|
+ b.is_lock = 0
|
|
|
+ and b.path LIKE concat(#{orgPath}, '%')
|
|
|
+ and b.deleted = 0
|
|
|
+ AND (b.type = 4 OR b.type = 5 OR b.type = 6)
|
|
|
+ ) a
|
|
|
</select>
|
|
|
<select id="getCollectLibrary" resultType="java.lang.Integer">
|
|
|
SELECT
|
|
|
@@ -970,10 +1015,10 @@ and
|
|
|
from (
|
|
|
|
|
|
select
|
|
|
- (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineThroughWalls,
|
|
|
- (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineLobbyImplement,
|
|
|
- (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureThroughWalls,
|
|
|
- (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureLobbyImplement
|
|
|
+ (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineLobbyImplement,
|
|
|
+ (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineThroughWalls,
|
|
|
+ (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureLobbyImplement,
|
|
|
+ (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureThroughWalls
|
|
|
from dual
|
|
|
) t
|
|
|
</select>
|
|
|
@@ -1240,9 +1285,10 @@ and
|
|
|
select count(*) from sys_org a
|
|
|
LEFT JOIN sys_org_extend b on a.id = b.org_id
|
|
|
WHERE 1=1
|
|
|
- and (b.inner_count > 0 or b.outside_count > 0)
|
|
|
and a.deleted = 0
|
|
|
and a.is_lock = 0
|
|
|
+ and a.type = 4
|
|
|
+ and b.askari = 1
|
|
|
and a.path LIKE concat( #{orgPath}, '%' )
|
|
|
</select>
|
|
|
<select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
|