|
|
@@ -17,25 +17,25 @@
|
|
|
and o.path like concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
<select id="selectOrgGa38" resultType="com.xunmei.core.board.dto.app.AppGA38InfoDto">
|
|
|
- SELECT count(0) as total,
|
|
|
- sum(m.ga382021) as ga382021,
|
|
|
+ SELECT count(0) as total,
|
|
|
+ sum(m.ga382021) as ga382021,
|
|
|
sum(m.ga382021current) as ga382021current,
|
|
|
- sum(m.ga382021prev) as ga382021prev,
|
|
|
- sum(m.ga382015) as ga382015,
|
|
|
+ sum(m.ga382021prev) as ga382021prev,
|
|
|
+ sum(m.ga382015) as ga382015,
|
|
|
sum(m.ga382015current) as ga382015current,
|
|
|
- sum(m.ga382021prev) as ga382021prev
|
|
|
+ sum(m.ga382021prev) as ga382021prev
|
|
|
from sys_org o
|
|
|
LEFT JOIN (SELECT org_id,
|
|
|
IF
|
|
|
(standard = 1, 1, 0) AS ga382021,
|
|
|
IF
|
|
|
- (standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0) AS ga382021current,
|
|
|
+ (standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0) AS ga382021current,
|
|
|
IF
|
|
|
(standard = 1, IF(date_of_compliance < #{date}, 1, 0), 0) AS ga382021prev,
|
|
|
IF
|
|
|
(standard = 2, 1, 0) AS ga382015,
|
|
|
IF
|
|
|
- (standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0) AS ga382015current,
|
|
|
+ (standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0) AS ga382015current,
|
|
|
IF
|
|
|
(standard = 2, IF(date_of_compliance < #{date}, 1, 0), 0) AS ga382015prev
|
|
|
FROM sys_org_physical_defense_construction
|
|
|
@@ -58,12 +58,12 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectOverViewSafetyCheckTaskInfo" resultType="com.xunmei.core.board.dto.app.AppOverviewTaskInfoDto">
|
|
|
- SELECT sum(if(t.ymd_date >= #{date}, 1, 0)) as total,
|
|
|
+ SELECT sum(if(t.ymd_date >= #{date}, 1, 0)) as total,
|
|
|
sum(if(t.ymd_date >= #{date}, (if(t.`status` = 3, 1, 0)), 0)) as completed,
|
|
|
- sum(if(t.ymd_date < #{date}, 1, 0)) as prevcount,
|
|
|
+ sum(if(t.ymd_date < #{date}, 1, 0)) as prevcount,
|
|
|
sum(if(t.ymd_date < #{date}, (if(t.`status` = 3, 1, 0)), 0)) as prevcompleted
|
|
|
FROM core_safety_task t
|
|
|
- INNER JOIN core_safecheck_plan p on t.plan_id=p.id and p.check_type=3
|
|
|
+ INNER JOIN core_safecheck_plan p on t.plan_id = p.id and p.check_type = 3
|
|
|
WHERE ymd_date >= #{prevdate}
|
|
|
and org_path like concat(#{orgPath}, '%')
|
|
|
</select>
|
|
|
@@ -106,79 +106,138 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectOrgBaseInfo" resultType="com.xunmei.core.board.dto.app.AppOrgBaseInfoDto">
|
|
|
- SELECT
|
|
|
- count(0) as total,
|
|
|
- sum(if(oh.org_id is null,1,0)) as unreachedCount,
|
|
|
- sum(if(o.type=4,1,0)) as bankingCount,
|
|
|
- sum(if(o.type=5,1,0)) as offATMCount,
|
|
|
- sum(if(o.type=4 and oh.ga382021 is not null,1,0)) as bankingGA382021 ,
|
|
|
- sum(if(o.type=4 and oh.ga382015 is not null,1,0)) as bankingGA382015 ,
|
|
|
- sum(if(o.type=5 and oh.ga382021 is not null,1,0)) as offATMGA382021 ,
|
|
|
- sum(if(o.type=5 and oh.ga382015 is not null,1,0)) as offATMGA382015,
|
|
|
- sum(if(oe.business_library_type=1,1,0)) as businessLibraryOne,
|
|
|
- sum(if(oe.business_library_type=2,1,0)) as businessLibraryTwo,
|
|
|
- sum(if(oe.business_library_type=3,1,0)) as businessLibraryThree,
|
|
|
- sum(if(oe.business_library_type=4,1,0)) as businessLibraryFour,
|
|
|
- sum(if(oe.askari=1,1,0)) as orgWithSecurityCount,
|
|
|
- sum(if(o.type=4 and oe.lobby_equipment is not null,oe.lobby_equipment,0)) as bankingObbyDeviceCount,
|
|
|
- sum(if(o.type=4 and oe.wall_penetrating_equipment is not null,oe.wall_penetrating_equipment,0)) as bankingWallDeviceCount,
|
|
|
- sum(if(o.type=5 and oe.lobby_equipment is not null,oe.lobby_equipment,0)) as offATMObbyDeviceCount,
|
|
|
- sum(if(o.type=5 and oe.wall_penetrating_equipment is not null,oe.wall_penetrating_equipment,0)) as offATMWallDeviceCount
|
|
|
- FROM
|
|
|
- sys_org o
|
|
|
- LEFT JOIN (SELECT org_id,
|
|
|
+ SELECT count(0) as total,
|
|
|
+ sum(if(oh.org_id is null, 1, 0)) as unreachedCount,
|
|
|
+ sum(if(o.type = 4, 1, 0)) as bankingCount,
|
|
|
+ sum(if(o.type = 5, 1, 0)) as offATMCount,
|
|
|
+ sum(if(o.type = 4 and oh.ga382021 is not null, 1, 0)) as bankingGA382021,
|
|
|
+ sum(if(o.type = 4 and oh.ga382015 is not null, 1, 0)) as bankingGA382015,
|
|
|
+ sum(if(o.type = 5 and oh.ga382021 is not null, 1, 0)) as offATMGA382021,
|
|
|
+ sum(if(o.type = 5 and oh.ga382015 is not null, 1, 0)) as offATMGA382015,
|
|
|
+ sum(if(oe.business_library_type = 1, 1, 0)) as businessLibraryOne,
|
|
|
+ sum(if(oe.business_library_type = 2, 1, 0)) as businessLibraryTwo,
|
|
|
+ sum(if(oe.business_library_type = 3, 1, 0)) as businessLibraryThree,
|
|
|
+ sum(if(oe.business_library_type = 4, 1, 0)) as businessLibraryFour,
|
|
|
+ sum(if(oe.askari = 1, 1, 0)) as orgWithSecurityCount,
|
|
|
+ sum(if(o.type = 4 and oe.lobby_equipment is not null, oe.lobby_equipment,
|
|
|
+ 0)) as bankingObbyDeviceCount,
|
|
|
+ sum(if(o.type = 4 and oe.wall_penetrating_equipment is not null, oe.wall_penetrating_equipment,
|
|
|
+ 0)) as bankingWallDeviceCount,
|
|
|
+ sum(if(o.type = 5 and oe.lobby_equipment is not null, oe.lobby_equipment,
|
|
|
+ 0)) as offATMObbyDeviceCount,
|
|
|
+ sum(if(o.type = 5 and oe.wall_penetrating_equipment is not null, oe.wall_penetrating_equipment,
|
|
|
+ 0)) as offATMWallDeviceCount
|
|
|
+ FROM sys_org o
|
|
|
+ LEFT JOIN (SELECT org_id,
|
|
|
IF
|
|
|
- (standard = 1, 1, 0) AS ga382021,
|
|
|
+ (standard = 1, 1, 0) AS ga382021,
|
|
|
|
|
|
|
|
|
IF
|
|
|
- (standard = 2, 1, 0) AS ga382015
|
|
|
+ (standard = 2, 1, 0) AS ga382015
|
|
|
|
|
|
FROM sys_org_physical_defense_construction
|
|
|
WHERE type = 1
|
|
|
OR type = 3
|
|
|
GROUP BY org_id) oh ON o.id = oh.org_id
|
|
|
- LEFT JOIN sys_org_extend oe on o.id=oe.org_id
|
|
|
- WHERE
|
|
|
- o.deleted = 0 and path like concat(#{orgPath}, '%')
|
|
|
+ LEFT JOIN sys_org_extend oe on o.id = oe.org_id
|
|
|
+ WHERE o.deleted = 0
|
|
|
+ and path like concat(#{orgPath}, '%')
|
|
|
AND (
|
|
|
o.type = 4
|
|
|
OR o.type = 5)
|
|
|
</select>
|
|
|
<select id="selectSyntheticResumption" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
|
|
|
- SELECT
|
|
|
- p.plan_type,
|
|
|
- count( 0 ) AS total,
|
|
|
- sum(
|
|
|
- IF
|
|
|
- ( r.STATUS = 3, 1, 0 )) AS completed,
|
|
|
- sum( r.exception_count ) AS exceptionCount
|
|
|
- FROM
|
|
|
- core_resumption r
|
|
|
- INNER JOIN core_resumption_plan p ON r.plan_id = p.id
|
|
|
- WHERE
|
|
|
- r.ymd_date BETWEEN #{startDate}
|
|
|
- AND #{endDate}
|
|
|
- AND r.org_path LIKE CONCAT( #{orgPath}, '%' )
|
|
|
- GROUP BY
|
|
|
- p.plan_type
|
|
|
+ SELECT p.plan_type,
|
|
|
+ count(0) AS total,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (r.STATUS = 3, 1, 0)) AS completed,
|
|
|
+ sum(r.exception_count) AS exceptionCount
|
|
|
+ FROM core_resumption r
|
|
|
+ INNER JOIN core_resumption_plan p ON r.plan_id = p.id
|
|
|
+ WHERE r.ymd_date BETWEEN #{startDate}
|
|
|
+ AND #{endDate}
|
|
|
+ AND r.org_path LIKE CONCAT(#{orgPath}, '%')
|
|
|
+ GROUP BY p.plan_type
|
|
|
</select>
|
|
|
<select id="selectSyntheticSafetyCheck" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
|
|
|
- SELECT
|
|
|
- p.plan_type,
|
|
|
- count( 0 ) AS total,
|
|
|
- sum(
|
|
|
- IF
|
|
|
- ( r.STATUS = 3, 1, 0 )) AS completed,
|
|
|
- sum( r.exception_count ) AS exceptionCount
|
|
|
- FROM
|
|
|
- core_safety_task r
|
|
|
- INNER JOIN core_safecheck_plan p ON r.plan_id = p.id
|
|
|
- WHERE
|
|
|
- r.ymd_date BETWEEN #{startDate}
|
|
|
- AND #{endDate}
|
|
|
- AND r.org_path LIKE CONCAT( #{orgPath}, '%' )
|
|
|
- GROUP BY
|
|
|
- p.plan_type
|
|
|
+ SELECT p.check_type as plan_type,
|
|
|
+ count(0) AS total,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (r.STATUS = 3, 1, 0)) AS completed,
|
|
|
+ sum(r.exception_count) AS exceptionCount
|
|
|
+ FROM core_safety_task r
|
|
|
+ INNER JOIN core_safecheck_plan p ON r.plan_id = p.id
|
|
|
+ WHERE r.ymd_date BETWEEN #{startDate}
|
|
|
+ AND #{endDate}
|
|
|
+ AND r.org_path LIKE CONCAT(#{orgPath}, '%')
|
|
|
+ GROUP BY p.check_type
|
|
|
+ </select>
|
|
|
+ <select id="selectSyntheticDrill" resultType="com.xunmei.core.board.dto.app.AppSyntheticTaskCategoryDto">
|
|
|
+ SELECT r.type as plan_type,
|
|
|
+ count(0) AS total,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (r.STATUS = 3, 1, 0)) AS completed
|
|
|
+ FROM core_drill_task r
|
|
|
+ WHERE r.start_date BETWEEN #{startDate}
|
|
|
+ AND #{endDate}
|
|
|
+ AND r.org_path LIKE CONCAT(#{orgPath}, '%')
|
|
|
+ GROUP BY r.type
|
|
|
+ </select>
|
|
|
+ <select id="selectSyntheticQuestion" resultType="com.xunmei.core.board.dto.app.AppSyntheticQuestionDto">
|
|
|
+ SELECT sum(
|
|
|
+ IF
|
|
|
+ (q.confirm_status >= 2, 1, 0)) AS confirmedCount,
|
|
|
+ sum(qf.count) AS dissentCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.confirm_status = 3 AND q.reform_status IS NULL, 1, 0)) AS cancelCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.confirm_status = 2, 1, 0)) AS waitReformCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.reform_status = 11, 1, 0)) AS reformedCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 1 AND q.src_task_type != 6, 1, 0)) AS resumptionCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 1 AND q.src_task_type != 6 AND q.reform_status = 11, 1,
|
|
|
+ 0)) resumptionReformedCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 1 AND q.src_task_type = 6, 1, 0)) AS offATMResumptionCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 1 AND q.src_task_type = 6 AND q.reform_status = 11, 1,
|
|
|
+ 0)) offATMResumptionReformedCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 2, 1, 0)) AS safetyCheckCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.src_type = 2 AND q.reform_status = 11, 1, 0)) safetyCheckReformedCount,
|
|
|
+ sum(
|
|
|
+ IF
|
|
|
+ (q.confirm_status >= 2 AND q.src_type = 2, 1, 0)) AS safetyCheckConfirmedCount
|
|
|
+ FROM core_question q
|
|
|
+ LEFT JOIN (SELECT question_id, count(0) AS count
|
|
|
+ FROM core_question_flow
|
|
|
+ WHERE execute_step = 1
|
|
|
+ AND execute_status = 1
|
|
|
+ GROUP BY question_id) qf ON q.id = qf.question_id
|
|
|
+ WHERE q.submit_time BETWEEN #{startDate} AND #{endDate}
|
|
|
+ AND q.org_path LIKE CONCAT(#{orgPath}, '%')
|
|
|
+ </select>
|
|
|
+ <select id="selectOverDueQuestionCount" resultType="java.lang.Integer">
|
|
|
+ SELECT count(0)
|
|
|
+ FROM core_question
|
|
|
+ WHERE reform_deadline BETWEEN '2023-10-01 00:00:00' AND '2023-11-30 23:59'
|
|
|
+ and reform_status != 11
|
|
|
+ and confirm_status != 3
|
|
|
</select>
|
|
|
</mapper>
|