|
@@ -146,4 +146,50 @@
|
|
|
<select id="exportMajorLedgerVO" resultType="com.dayou.vo.MajorLedgerVO">
|
|
|
<include refid="majorLedgerQuery" />
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--评估部绩效扣分查询-->
|
|
|
+ <select id="getMajorPerformanceDeductionVO" resultType="com.dayou.vo.MajorPerformanceDeductionVO">
|
|
|
+ SELECT
|
|
|
+ department.id AS departmentId,
|
|
|
+ department.name AS departmentName,
|
|
|
+ COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) * 3 AS reCheckNormalMistakeScore,
|
|
|
+ COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) * 8 AS reCheckHardMistakeScore,
|
|
|
+ COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) * 41 AS reCheckFatalMistakeScore,
|
|
|
+ COALESCE ( (COALESCE ( SUM( reCheckPer.normal_mistake ), 0 ) *3 ) + (COALESCE ( SUM( reCheckPer.hard_mistake ), 0 ) * 8) + (COALESCE ( SUM( reCheckPer.fatal_mistake ), 0 ) * 41) , 0) AS allMistakeScore
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ department.id,
|
|
|
+ department.name
|
|
|
+ FROM
|
|
|
+ department,
|
|
|
+ sorted_department
|
|
|
+ WHERE
|
|
|
+ department.id = sorted_department.department_id
|
|
|
+ AND department.deleted = 0
|
|
|
+ AND sorted_department.business_type = 'MAJOR_BUSINESS'
|
|
|
+ ) AS department
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ department_id,
|
|
|
+ major.created,
|
|
|
+ major_production.id AS production_id
|
|
|
+ FROM
|
|
|
+ major
|
|
|
+ LEFT JOIN major_production ON major_production.major_id = major.id
|
|
|
+ AND major_production.deleted = 0
|
|
|
+ ) AS orderInfo ON department.id = orderInfo.department_id
|
|
|
+ LEFT JOIN ( SELECT production_id, fatal_mistake, hard_mistake, normal_mistake FROM
|
|
|
+ business_production_performance WHERE business_type = 'MAJOR_BUSINESS' AND check_loop = '复审'
|
|
|
+ <if test="dto != null and dto.startTime != null and dto.endTime!= null">
|
|
|
+ AND (business_production_performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
|
|
|
+ </if>
|
|
|
+ ) AS reCheckPer ON reCheckPer.production_id = orderInfo.production_id
|
|
|
+ <where>
|
|
|
+ <if test="dto != null and dto.departmentId != null">
|
|
|
+ AND department.id = #{dto.departmentId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY department.id
|
|
|
+ </select>
|
|
|
</mapper>
|