|
@@ -244,6 +244,66 @@
|
|
|
GROUP BY user.id
|
|
|
</select>
|
|
|
|
|
|
+ <!--根据部门id获取部门绩效扣分-->
|
|
|
+ <select id="getMajorPerformanceDeductionVOByDepId" resultType="com.dayou.vo.MajorPerformanceDeductionVO">
|
|
|
+ SELECT user.id AS userId,
|
|
|
+ user.userName,
|
|
|
+ user.departmentId,
|
|
|
+ user.departmentName,
|
|
|
+ COALESCE ( SUM( checkPer.normal_mistake ), 0 ) * 3 AS checkNormalMistakeScore,
|
|
|
+ COALESCE ( SUM( checkPer.hard_mistake ), 0 ) * 8 AS checkHardMistakeScore,
|
|
|
+ COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) * 41 AS checkFatalMistakeScore,
|
|
|
+ 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( checkPer.normal_mistake ), 0 ) * 3) + (COALESCE ( SUM( checkPer.hard_mistake ), 0 ) * 8) + (COALESCE ( SUM( checkPer.fatal_mistake ), 0 ) * 41) + (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 user.id AS id,
|
|
|
+ user.`name` AS userName,
|
|
|
+ department.name AS departmentName,
|
|
|
+ department.id AS departmentId
|
|
|
+ FROM user,post,user_post,sorted_department,department
|
|
|
+ WHERE `user`.id = user_post.user_id
|
|
|
+ AND user_post.post_id = post.id
|
|
|
+ AND post.department_id = sorted_department.department_id
|
|
|
+ AND sorted_department.department_id = department.id
|
|
|
+ AND sorted_department.deleted = 0
|
|
|
+ AND user_post.deleted = 0
|
|
|
+ AND sorted_department.business_type = 'MAJOR_BUSINESS'
|
|
|
+ GROUP BY user.id
|
|
|
+ ) AS user
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ principal_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 user.id = orderInfo.principal_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 checkPer ON checkPer.production_id = orderInfo.production_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 user.departmentId = #{dto.departmentId}
|
|
|
+ </if>
|
|
|
+ <if test="dto != null and dto.userName != null">
|
|
|
+ AND user.userName LIKE CONCAT('%',#{dto.userName},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY user.id
|
|
|
+ </select>
|
|
|
+
|
|
|
<!--查询错误详情SQL-->
|
|
|
<sql id="majorPerformanceDeductionDetailQuery">
|
|
|
SELECT performance.id,
|