|
|
@@ -6,8 +6,8 @@
|
|
|
|
|
|
<select id="selectReport" resultType="com.xunmei.core.reportForms.resumption.vo.ResumptionDayVO">
|
|
|
SELECT
|
|
|
- COUNT( d.id ) AS totalRealityRectificationNumber,
|
|
|
- COUNT( a.id ) AS frontPlanNumber,
|
|
|
+ IFNULL(SUM( a.exception_reform_count ) ,0)AS totalRealityRectificationNumber,
|
|
|
+ COUNT(DISTINCT a.id ) AS frontPlanNumber,
|
|
|
IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 ) AS frontRealityNumber,
|
|
|
IF
|
|
|
(
|
|
|
@@ -25,16 +25,22 @@
|
|
|
)) AS frontRate,
|
|
|
IFNULL( SUM( a.exception_count ), 0 ) AS frontAbnormalNumber,
|
|
|
IFNULL(
|
|
|
- CONCAT( ROUND( COUNT( d.id )/ IFNULL( SUM( a.exception_count ), 0 )* 100, 2 ), '%' ),
|
|
|
+ CONCAT( ROUND( COUNT( a.exception_reform_count )/ IFNULL( SUM( a.exception_count ), 0 )* 100, 2 ), '%' ),
|
|
|
'0%'
|
|
|
) AS totalRealityRectificationRate
|
|
|
FROM
|
|
|
- core_resumption a
|
|
|
- LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
- LEFT JOIN core_question d ON a.id = d.src_task_id
|
|
|
- AND d.reform_status = 11
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ r.*,
|
|
|
+ b.plan_type,
|
|
|
+ (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
|
|
|
+ FROM
|
|
|
+ core_resumption r
|
|
|
+ INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
|
|
|
+ LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
|
|
|
+ ) a
|
|
|
WHERE
|
|
|
- b.plan_type = #{planType}
|
|
|
+ a.plan_type = #{planType}
|
|
|
AND a.type = 2
|
|
|
<if test="orgId !=null">
|
|
|
AND a.org_id = #{orgId}
|
|
|
@@ -78,12 +84,18 @@
|
|
|
'%'
|
|
|
)) AS realityRate
|
|
|
FROM
|
|
|
- core_resumption a
|
|
|
- LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
- LEFT JOIN core_question c ON c.src_task_id = a.id
|
|
|
- AND reform_status = 11
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ r.*,
|
|
|
+ b.plan_type,
|
|
|
+ (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
|
|
|
+ FROM
|
|
|
+ core_resumption r
|
|
|
+ INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
|
|
|
+ LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
|
|
|
+ ) a
|
|
|
WHERE
|
|
|
- b.plan_type =4
|
|
|
+ a.plan_type =4
|
|
|
<if test="orgId !=null">
|
|
|
and a.org_id=#{orgId}
|
|
|
</if>
|
|
|
@@ -114,20 +126,24 @@
|
|
|
/* COUNT( c.id ) AS realityRectificationNumber,*/
|
|
|
IF
|
|
|
(
|
|
|
- COUNT( c.id )= 0
|
|
|
+ COUNT( a.exception_reform_count )= 0
|
|
|
OR IFNULL( a.exception_count, 0 )= 0,
|
|
|
'0%',
|
|
|
- CONCAT(ROUND(COUNT( c.id )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
|
|
|
+ CONCAT(ROUND(COUNT( a.exception_reform_count )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
|
|
|
FROM
|
|
|
- core_resumption a
|
|
|
- LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
- LEFT JOIN core_question c ON c.src_task_id = a.id
|
|
|
- AND reform_status = 11
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ r.*,
|
|
|
+ b.plan_type,
|
|
|
+ (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
|
|
|
+ FROM
|
|
|
+ core_resumption r
|
|
|
+ INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
|
|
|
+ LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
|
|
|
+ ) a
|
|
|
WHERE
|
|
|
- b.plan_type =5
|
|
|
+ a.plan_type =5
|
|
|
<if test="startTime !=null and endTime !=null">
|
|
|
-
|
|
|
-
|
|
|
and ((
|
|
|
#{startTime} <= a.plan_start_time
|
|
|
and #{endTime} >= a.plan_start_time
|
|
|
@@ -166,20 +182,26 @@
|
|
|
),
|
|
|
'%'
|
|
|
)) AS realityRate,
|
|
|
- COUNT( c.id ) AS realityRectificationNumber,
|
|
|
+ IFNULL(SUM( c.exception_reform_count ),0) AS realityRectificationNumber,
|
|
|
IF
|
|
|
(
|
|
|
- COUNT( c.id )= 0
|
|
|
+ COUNT( c.exception_reform_count )= 0
|
|
|
OR IFNULL( a.exception_count, 0 )= 0,
|
|
|
'0%',
|
|
|
- CONCAT(ROUND(COUNT( c.id )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
|
|
|
+ CONCAT(ROUND(COUNT( c.exception_reform_count )/ IFNULL( a.exception_count, 0 )* 100,2) , '%' )) AS realityRectificationRate
|
|
|
FROM
|
|
|
- core_resumption a
|
|
|
- LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
|
|
|
- LEFT JOIN core_question c ON c.src_task_id = a.id
|
|
|
- AND reform_status = 11
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ r.*,
|
|
|
+ b.plan_type,
|
|
|
+ (SELECT COUNT(d.id) from core_question d WHERE r.id = d.src_task_id AND d.reform_status IN (11,13)) as exception_reform_count
|
|
|
+ FROM
|
|
|
+ core_resumption r
|
|
|
+ INNER JOIN sys_org o ON r.org_id=o.id AND o.deleted=0 AND o.is_lock =0
|
|
|
+ LEFT JOIN core_resumption_plan b ON r.plan_id = b.id
|
|
|
+ ) a
|
|
|
WHERE
|
|
|
- b.plan_type =6
|
|
|
+ a.plan_type =6
|
|
|
<if test="date !=null">
|
|
|
AND a.ymd_date like concat(#{date},'%')
|
|
|
</if>
|