|
|
@@ -831,15 +831,15 @@ and
|
|
|
</select>
|
|
|
<select id="getLibrary" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- COUNT(a.business_library_type ) as total,
|
|
|
- sum(IF(a.business_library_type=1,1,0)) AS one,
|
|
|
- SUM(IF(a.business_library_type=2,1,0)) as two,
|
|
|
- SUM(IF(a.business_library_type=3,1,0)) AS three,
|
|
|
- SUM(IF(a.business_library_type=4,1,0)) AS four
|
|
|
+ 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
|
|
|
FROM
|
|
|
sys_org_extend a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
- where
|
|
|
+ where
|
|
|
b.path LIKE concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="getCollectLibrary" resultType="java.lang.Integer">
|
|
|
@@ -855,12 +855,8 @@ and
|
|
|
</select>
|
|
|
<select id="getOnLine" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( a.type = 3, 1, 0 )) AS onLineTotal,
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( a.type = 3 AND a.standard =1, 1, 0 )) AS onLineReachNumber
|
|
|
+ IFNULL( SUM( IF ( a.type = 3, 1, 0 )), 0 ) AS onLineTotal,
|
|
|
+ IFNULL( SUM( IF ( a.type = 3 AND a.standard = 1, 1, 0 )), 0 ) AS onLineReachNumber
|
|
|
FROM
|
|
|
sys_org_physical_defense_construction a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
@@ -869,12 +865,8 @@ and
|
|
|
</select>
|
|
|
<select id="getDeparture" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( a.type = 4, 1, 0 )) AS departureTotal,
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( a.type = 4 AND a.standard = 1, 1, 0 )) AS departureReachNumber
|
|
|
+ IFNULL( SUM( IF ( a.type = 4, 1, 0 )), 0 ) AS departureTotal,
|
|
|
+ IFNULL( SUM( IF ( a.type = 4 AND a.standard = 1, 1, 0 )), 0 ) AS departureReachNumber
|
|
|
FROM
|
|
|
sys_org_physical_defense_construction a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
@@ -883,11 +875,14 @@ and
|
|
|
</select>
|
|
|
<select id="getSelfEquipment" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- SUM( a.lobby_equipment ) AS onLineLobbyImplement,
|
|
|
- SUM( a.wall_penetrating_equipment ) AS onLineThroughWalls,
|
|
|
- SUM( a.detached_lobby_equipment ) AS departureLobbyImplement,
|
|
|
- SUM( a.detached_wall_penetrating_equipment ) AS departureThroughWalls,
|
|
|
- SUM( a.lobby_equipment ) + SUM( a.wall_penetrating_equipment ) + SUM( a.detached_lobby_equipment ) + SUM( a.detached_wall_penetrating_equipment ) AS selfServiceDevicesTotal
|
|
|
+ IFNULL( SUM( a.lobby_equipment ), 0 ) AS onLineLobbyImplement,
|
|
|
+ IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) AS onLineThroughWalls,
|
|
|
+ IFNULL( SUM( a.detached_lobby_equipment ), 0 ) AS departureLobbyImplement,
|
|
|
+ IFNULL( SUM( a.detached_wall_penetrating_equipment ), 0 ) AS departureThroughWalls,
|
|
|
+ IFNULL(
|
|
|
+ SUM( a.lobby_equipment ) + SUM( a.wall_penetrating_equipment ) + SUM( a.detached_lobby_equipment ) + SUM( a.detached_wall_penetrating_equipment ),
|
|
|
+ 0
|
|
|
+ ) AS selfServiceDevicesTotal
|
|
|
FROM
|
|
|
sys_org_extend a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
@@ -896,49 +891,130 @@ and
|
|
|
</select>
|
|
|
<select id="getCenterConstruction" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- IF
|
|
|
- ( a.construction_time IS NULL, '', SUBSTR( a.construction_time, 1, 4 ) ) AS centerConstructionTime,
|
|
|
- IF
|
|
|
- ( a.last_update_time IS NULL, '', SUBSTR( a.last_update_time, 1, 4 ) ) AS transformTime,
|
|
|
- a.platform_brand AS brand
|
|
|
+ IFNULL( IF ( a.construction_time IS NULL, '0', SUBSTR( a.construction_time, 1, 4 ) ), '0' ) AS centerConstructionTime,
|
|
|
+ IFNULL( IF ( a.last_update_time IS NULL, '0', SUBSTR( a.last_update_time, 1, 4 ) ), '0' ) AS transformTime,
|
|
|
+ IFNULL( a.platform_brand, '0' ) AS brand
|
|
|
FROM
|
|
|
sys_org_extend a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
-WHERE b.id=#{orgId}
|
|
|
+ WHERE b.id=#{orgId}
|
|
|
</select>
|
|
|
<select id="getCamera" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- COUNT( 1 ) AS cameraTotal,
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( definition = 1, 1, 0 )) AS definitionNumber
|
|
|
+ IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
|
|
|
+ IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
|
|
|
FROM
|
|
|
- sys_device
|
|
|
+ sys_device a
|
|
|
+ LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
WHERE
|
|
|
- del_flag=0 AND
|
|
|
- device_type =2 AND org_path LIKE concat(#{orgPath}, '%')
|
|
|
+ del_flag = 0
|
|
|
+ AND device_type = 2
|
|
|
+ AND b.path LIKE concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="getRemote" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- SUM( a.cash_adding_room ) AS cashAddingRoom,
|
|
|
- SUM( a.remote_count ) AS remoteCount
|
|
|
+ IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
|
|
|
+ IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount
|
|
|
FROM
|
|
|
sys_org_extend a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
-where org_path LIKE concat(#{orgPath}, '%')
|
|
|
+ where b.path LIKE concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="getDuty" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( duty_mode = 2, 1, 0 )) AS localDutyNetworkNumber,
|
|
|
- SUM(
|
|
|
- IF
|
|
|
- ( duty_mode = 1, 1, 0 )) AS remoteDutyNetworkNumber
|
|
|
+ IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
|
|
|
+ IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
|
|
|
FROM
|
|
|
sys_org_extend a
|
|
|
LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
- where org_path LIKE concat(#{orgPath}, '%')
|
|
|
+ where b.path LIKE concat(#{orgPath}, '%')
|
|
|
+ </select>
|
|
|
+ <select id="getCertificate" resultType="java.util.Map">
|
|
|
+SELECT
|
|
|
+ IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
|
|
|
+ IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
|
|
|
+ IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
|
|
|
+ IFNULL( SUM( IF ( a.askari_certificate IS NULL, 0, 1 )), 0 ) AS certificatePeopleNumber
|
|
|
+ FROM
|
|
|
+ sys_org_extend a
|
|
|
+ LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
+ where b.path LIKE concat(#{orgPath}, '%')
|
|
|
+ </select>
|
|
|
+ <select id="getSafe" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT( a.id )
|
|
|
+ FROM
|
|
|
+ core_safety_task a
|
|
|
+ LEFT JOIN sys_org b ON a.org_id = b.id
|
|
|
+ LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
|
|
|
+ WHERE
|
|
|
+ a.deleted = 0
|
|
|
+ AND c.check_type =3
|
|
|
+and a.org_path LIKE concat(#{orgPath}, '%')
|
|
|
+ AND a.ymd_date BETWEEN #{startTime} and #{endTime}
|
|
|
+ </select>
|
|
|
+ <select id="getEduNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT( a.id )
|
|
|
+ FROM
|
|
|
+ core_edu_training_task a
|
|
|
+ LEFT JOIN core_edu_training_plan b ON a.plan_id = b.id
|
|
|
+ WHERE
|
|
|
+ b.exec_org_type = 1
|
|
|
+ AND b.deleted =0
|
|
|
+ and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
+ AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </select>
|
|
|
+ <select id="getEduUser" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT( b.edu_training_task_id )
|
|
|
+ FROM
|
|
|
+ core_edu_training_task a
|
|
|
+ LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
|
|
|
+ WHERE
|
|
|
+ b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
+ </select>
|
|
|
+ <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(a.id)
|
|
|
+ FROM
|
|
|
+ core_drill_task a
|
|
|
+ LEFT JOIN core_drill_plan b ON a.plan_id = b.id
|
|
|
+ WHERE b.exec_org_type=1
|
|
|
+ and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
+ AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </select>
|
|
|
+ <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT( c.drill_task_id )
|
|
|
+ FROM
|
|
|
+ core_drill_task a
|
|
|
+ LEFT JOIN core_drill_plan b ON a.plan_id = b.id
|
|
|
+ LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
|
|
|
+ WHERE
|
|
|
+ b.exec_org_type = 1
|
|
|
+ and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
+ </select>
|
|
|
+ <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT(a.id)
|
|
|
+ FROM
|
|
|
+ core_drill_task a
|
|
|
+ LEFT JOIN core_drill_plan b ON a.plan_id = b.id
|
|
|
+ WHERE b.exec_org_type=4
|
|
|
+ and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
+ AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </select>
|
|
|
+ <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ COUNT( c.drill_task_id )
|
|
|
+ FROM
|
|
|
+ core_drill_task a
|
|
|
+ LEFT JOIN core_drill_plan b ON a.plan_id = b.id
|
|
|
+ LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
|
|
|
+ WHERE
|
|
|
+ b.exec_org_type = 4
|
|
|
+ and a.org_path like concat(concat('%',#{orgPath}),'%')
|
|
|
</select>
|
|
|
|
|
|
|