|
@@ -192,4 +192,120 @@
|
|
|
</where>
|
|
|
GROUP BY department.id
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--评估人员绩效扣分查询-->
|
|
|
+ <select id="getMajorPerformanceDeductionVOByEvaluator" resultType="com.dayou.vo.MajorPerformanceDeductionVO">
|
|
|
+ SELECT user.id AS userId,
|
|
|
+ user.userName,
|
|
|
+ user.departmentId,
|
|
|
+ user.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 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 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,
|
|
|
+ major.order_id AS orderId,
|
|
|
+ major.financial AS financial,
|
|
|
+ major.members AS members,
|
|
|
+ major.evaluate_aim AS evaluateAim,
|
|
|
+ production.name AS projectName,
|
|
|
+ customer.name AS customerName,
|
|
|
+ production.report_no AS productionNo,
|
|
|
+ (CASE production.production
|
|
|
+ WHEN 'STATEMENT' THEN '意见书'
|
|
|
+ WHEN 'LETTER' THEN '意见函'
|
|
|
+ WHEN 'REPORT' THEN '评估报告'
|
|
|
+ END) AS productionType,
|
|
|
+ principal.name AS principalName,
|
|
|
+ checker.name AS checkerName,
|
|
|
+ (CASE #{dto.mistakeType}
|
|
|
+ WHEN 'normal' THEN performance.normal_mistake
|
|
|
+ WHEN 'hard' THEN performance.hard_mistake
|
|
|
+ WHEN 'fatal' THEN performance.fatal_mistake
|
|
|
+ ELSE '-'
|
|
|
+ END) AS mistakeCount,
|
|
|
+ (CASE #{dto.mistakeType}
|
|
|
+ WHEN 'normal' THEN performance.normal_mistake * 3
|
|
|
+ WHEN 'hard' THEN performance.hard_mistake * 8
|
|
|
+ WHEN 'fatal' THEN performance.fatal_mistake * 41
|
|
|
+ ELSE '-'
|
|
|
+ END) AS mistakeScore,
|
|
|
+ production.evaluate_amount AS evaluateAmount,
|
|
|
+ performance.modified AS checkTime,
|
|
|
+ performance.reason AS reason
|
|
|
+ FROM major
|
|
|
+ LEFT JOIN major_production AS production ON major.id = production.major_id
|
|
|
+ LEFT JOIN business_production_performance AS performance ON production.id = performance.production_id
|
|
|
+ LEFT JOIN customer_company AS customer ON customer.id = major.clientele_id
|
|
|
+ LEFT JOIN user AS principal ON principal.id = major.principal_id
|
|
|
+ LEFT JOIN user AS checker ON checker.id = performance.check_id
|
|
|
+ WHERE major.department_id = #{dto.departmentId}
|
|
|
+ AND performance.check_loop = #{dto.checkLoop}
|
|
|
+ AND (performance.modified BETWEEN #{dto.startTime} AND #{dto.endTime})
|
|
|
+ <if test="dto.principalId != null">
|
|
|
+ AND major.principal_id = #{dto.principalId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.mistakeType == 'normal' ">
|
|
|
+ AND performance.normal_mistake > 0
|
|
|
+ </if>
|
|
|
+ <if test="dto.mistakeType == 'hard' ">
|
|
|
+ AND performance.hard_mistake > 0
|
|
|
+ </if>
|
|
|
+ <if test="dto.mistakeType == 'fatal' ">
|
|
|
+ AND performance.fatal_mistake > 0
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--查询错误详情列表-->
|
|
|
+ <select id="getMajorPerformanceDeductionDetailVO" resultType="com.dayou.vo.MajorPerformanceDeductionDetailVO">
|
|
|
+ <include refid="majorPerformanceDeductionDetailQuery" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--导出错误详情列表-->
|
|
|
+ <select id="exportMajorPerformanceDeductionDetailVO" resultType="com.dayou.vo.MajorPerformanceDeductionDetailVO">
|
|
|
+ <include refid="majorPerformanceDeductionDetailQuery" />
|
|
|
+ </select>
|
|
|
</mapper>
|