|
|
@@ -12,7 +12,18 @@
|
|
|
inner join core_resumption_plan p on r.plan_id=p.id and p.plan_cycle < 5
|
|
|
<!-- INNER join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
|
|
|
WHERE
|
|
|
- (plan_start_time >= #{startDate} and plan_end_time<=#{endDate})
|
|
|
+ ((
|
|
|
+ #{startDate} <![CDATA[<=]]> r.plan_start_time
|
|
|
+ and #{endDate} >= r.plan_start_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} <![CDATA[<=]]> r.plan_end_time
|
|
|
+ and #{endDate} >= r.plan_end_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} >= r.plan_start_time
|
|
|
+ and #{endDate} <![CDATA[<=]]> r.plan_end_time
|
|
|
+ ))
|
|
|
and org_path like concat(#{orgPath},'%')
|
|
|
GROUP BY org_id,org_path
|
|
|
</select>
|
|
|
@@ -37,7 +48,7 @@
|
|
|
count(0) as total,
|
|
|
sum(if(t.`status` = 3, 1, 0)) as completed
|
|
|
FROM core_safety_task t
|
|
|
- INNER JOIN core_safecheck_plan p on t.plan_id = p.id
|
|
|
+ INNER JOIN core_safecheck_plan p on t.plan_id = p.id
|
|
|
where t.org_path like concat(#{orgPath}, '%')
|
|
|
and ((
|
|
|
#{startDate} <![CDATA[<=]]> t.plan_start_time
|
|
|
@@ -64,8 +75,18 @@
|
|
|
core_monitoring_retrieval_task r
|
|
|
<!-- INNER join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
|
|
|
WHERE
|
|
|
- ((plan_start_time >= #{startDate} and plan_end_time<=#{endDate}) or (plan_start_time<=#{startDate} and
|
|
|
- plan_end_time>=#{startDate}))
|
|
|
+ ((
|
|
|
+ #{startDate} <![CDATA[<=]]> r.plan_start_time
|
|
|
+ and #{endDate} >= r.plan_start_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} <![CDATA[<=]]> r.plan_end_time
|
|
|
+ and #{endDate} >= r.plan_end_time
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} >= r.plan_start_time
|
|
|
+ and #{endDate} <![CDATA[<=]]> r.plan_end_time
|
|
|
+ ))
|
|
|
and org_path like concat(#{orgPath},'%')
|
|
|
GROUP BY
|
|
|
org_id,org_path
|
|
|
@@ -75,13 +96,24 @@
|
|
|
org_id,
|
|
|
org_path,
|
|
|
count( 0 ) AS task_total,
|
|
|
- SUM( CASE `status` WHEN 4 THEN 1 ELSE 0 END ) AS completed_count
|
|
|
+ SUM( CASE `status` WHEN 2 THEN 1 ELSE 0 END ) AS completed_count
|
|
|
FROM
|
|
|
core_edu_training_task r
|
|
|
<!-- INNER join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
|
|
|
WHERE
|
|
|
- ((start_date >= #{startDate} and end_date<=#{endDate}) or (start_date<=#{startDate} and
|
|
|
- end_date>=#{startDate}))
|
|
|
+ ((
|
|
|
+ #{startDate} <![CDATA[<=]]> r.start_date
|
|
|
+ and #{endDate} >= r.start_date
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} <![CDATA[<=]]> r.end_date
|
|
|
+ and #{endDate} >= r.end_date
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} >= r.start_date
|
|
|
+ and #{endDate} <![CDATA[<=]]> r.end_date
|
|
|
+ ))
|
|
|
+
|
|
|
and org_path like concat(#{orgPath},'%')
|
|
|
GROUP BY
|
|
|
org_id,org_path
|
|
|
@@ -91,13 +123,23 @@
|
|
|
org_id,
|
|
|
org_path,
|
|
|
count( 0 ) AS task_total,
|
|
|
- SUM( CASE `status` WHEN 4 THEN 1 ELSE 0 END ) AS completed_count
|
|
|
+ SUM( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS completed_count
|
|
|
FROM
|
|
|
core_drill_task r
|
|
|
<!-- INNER join ( SELECT id,path FROM sys_org WHERE path LIKE CONCAT(( SELECT path FROM sys_org WHERE id =#{orgId}), '%' ) AND deleted = 0 ) o on r.org_Id=o.id-->
|
|
|
WHERE
|
|
|
- ((start_date >= #{startDate} and end_date<=#{endDate}) or (start_date<=#{startDate} and
|
|
|
- end_date>=#{startDate}))
|
|
|
+ ((
|
|
|
+ #{startDate} <![CDATA[<=]]> r.start_date
|
|
|
+ and #{endDate} >= r.start_date
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} <![CDATA[<=]]> r.end_date
|
|
|
+ and #{endDate} >= r.end_date
|
|
|
+ )
|
|
|
+ or (
|
|
|
+ #{startDate} >= r.start_date
|
|
|
+ and #{endDate} <![CDATA[<=]]> r.end_date
|
|
|
+ ))
|
|
|
and org_path like concat(#{orgPath},'%')
|
|
|
GROUP BY
|
|
|
org_id,org_path
|
|
|
@@ -111,9 +153,9 @@
|
|
|
from sys_org o
|
|
|
LEFT JOIN (SELECT org_id,
|
|
|
sum(standard = 1) AS ga382021,
|
|
|
- sum(IF(standard = 1, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382021current,
|
|
|
+ sum(IF(standard = 1 and date_of_compliance >= #{date}, 1,0)) AS ga382021current,
|
|
|
sum(standard = 2) AS ga382015,
|
|
|
- sum(IF(standard = 2, IF(date_of_compliance >= #{date}, 1, 0), 0)) AS ga382015current
|
|
|
+ sum(IF(standard = 2 and date_of_compliance >= #{date}, 1, 0)) AS ga382015current
|
|
|
FROM sys_org_physical_defense_construction
|
|
|
WHERE type = 1
|
|
|
OR type = 3
|
|
|
@@ -136,7 +178,7 @@
|
|
|
</select>
|
|
|
<select id="orgSecurityInfo" resultType="com.xunmei.core.board.vo.web.OrgSecurityInfoVo">
|
|
|
select sum(if(oe.askari = 1, 1, 0)) as equippedCount,
|
|
|
- sum(if(oe.askari != 1, 1, 0)) as unequippedCount
|
|
|
+ sum(if(oe.askari != 1 || oe.askari is null, 1, 0)) as unequippedCount
|
|
|
from sys_org o
|
|
|
LEFT JOIN sys_org_extend oe on o.id = oe.org_id
|
|
|
WHERE o.deleted = 0
|
|
|
@@ -172,7 +214,7 @@
|
|
|
SELECT count(0) as total,
|
|
|
sum(
|
|
|
IF
|
|
|
- (q.confirm_status = 0, 1, 0)) AS confirmedCount,
|
|
|
+ (q.confirm_status = 0, 1, 0)) AS unconfirmedCount,
|
|
|
sum(qf.count) AS dissentCount,
|
|
|
sum(
|
|
|
IF
|
|
|
@@ -194,8 +236,7 @@
|
|
|
</select>
|
|
|
<select id="selectOverDueQuestionCount" resultType="Map">
|
|
|
SELECT count(0) as count,
|
|
|
- if(reform_status != 11 and confirm_status != 3, 1, 0) as overdueCount
|
|
|
+ sum(if(reform_status != 11 and confirm_status != 3 and reform_deadline >= #{startDate} and reform_deadline <=#{endDate}, 1, 0)) as overdueCount
|
|
|
FROM core_question
|
|
|
- WHERE reform_deadline >= #{startDate}
|
|
|
</select>
|
|
|
</mapper>
|