|
|
@@ -0,0 +1,132 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.jeeplus.assess.program.issueStatistics.mapper.IssueStatisticsMapper">
|
|
|
+
|
|
|
+ <!-- 按问题分组汇总统计 -->
|
|
|
+ <select id="selectSummary" resultType="com.jeeplus.assess.program.issueStatistics.service.dto.IssueStatisticsSummaryDTO">
|
|
|
+ SELECT
|
|
|
+ ci.id AS issueId,
|
|
|
+ ci.issue_name AS issueName,
|
|
|
+ ci.category AS category,
|
|
|
+ COUNT(r.id) AS markCount,
|
|
|
+ COUNT(DISTINCT r.project_id) AS projectCount,
|
|
|
+ COUNT(DISTINCT r.target_user_id) AS targetUserCount
|
|
|
+ FROM program_issue_record r
|
|
|
+ INNER JOIN program_common_issue ci ON r.issue_id = ci.id AND ci.del_flag = 0
|
|
|
+ WHERE r.del_flag = 0
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND r.mark_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND r.mark_time <= #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="category != null and category != ''">
|
|
|
+ AND ci.category = #{category}
|
|
|
+ </if>
|
|
|
+ <if test="issueId != null and issueId != ''">
|
|
|
+ AND ci.id = #{issueId}
|
|
|
+ </if>
|
|
|
+ <if test="auditLevel != null and auditLevel != ''">
|
|
|
+ AND r.audit_level = #{auditLevel}
|
|
|
+ </if>
|
|
|
+ GROUP BY ci.id, ci.issue_name, ci.category
|
|
|
+ ORDER BY markCount DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询某问题的明细记录 -->
|
|
|
+ <select id="selectDetailByIssueId" resultType="com.jeeplus.assess.program.issueStatistics.service.dto.IssueStatisticsDetailDTO">
|
|
|
+ SELECT
|
|
|
+ r.project_id AS projectId,
|
|
|
+ p.name AS projectName,
|
|
|
+ prn.report_no AS reportNo,
|
|
|
+ p.client_name AS clientName,
|
|
|
+ tu.name AS targetUserName,
|
|
|
+ r.audit_level AS auditLevel,
|
|
|
+ mu.name AS markUserName,
|
|
|
+ r.mark_time AS markTime,
|
|
|
+ pa1.id AS auditId1,
|
|
|
+ pa2.id AS auditId2,
|
|
|
+ pa3.id AS auditId3,
|
|
|
+ paa.id AS archiveId
|
|
|
+ FROM program_issue_record r
|
|
|
+ INNER JOIN program_common_issue ci ON r.issue_id = ci.id AND ci.del_flag = 0
|
|
|
+ LEFT JOIN program_project_list_info p ON r.project_id = p.id
|
|
|
+ LEFT JOIN program_report_no prn ON prn.program_id = p.id AND prn.del_flag = '0'
|
|
|
+ LEFT JOIN sys_user tu ON r.target_user_id = tu.id
|
|
|
+ LEFT JOIN sys_user mu ON r.mark_user_id = mu.id
|
|
|
+ LEFT JOIN program_audit pa1 ON pa1.program_id = p.id AND pa1.audit_level = '1' AND pa1.del_flag = '0'
|
|
|
+ LEFT JOIN program_audit pa2 ON pa2.program_id = p.id AND pa2.audit_level = '2' AND pa2.del_flag = '0'
|
|
|
+ LEFT JOIN program_audit pa3 ON pa3.program_id = p.id AND pa3.audit_level = '3' AND pa3.del_flag = '0'
|
|
|
+ LEFT JOIN program_archive paa ON paa.program_id = p.id AND paa.del_flag = '0'
|
|
|
+ WHERE r.del_flag = 0
|
|
|
+ AND ci.id = #{issueId}
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND r.mark_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND r.mark_time <= #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="auditLevel != null and auditLevel != ''">
|
|
|
+ AND r.audit_level = #{auditLevel}
|
|
|
+ </if>
|
|
|
+ ORDER BY r.mark_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询导出数据(全量明细,含问题名称) -->
|
|
|
+ <select id="selectExportData" resultType="com.jeeplus.assess.program.issueStatistics.service.dto.IssueStatisticsExportDTO">
|
|
|
+ SELECT
|
|
|
+ ci.issue_name AS issueName,
|
|
|
+ ci.category AS category,
|
|
|
+ p.name AS projectName,
|
|
|
+ prn.report_no AS reportNo,
|
|
|
+ p.client_name AS clientName,
|
|
|
+ tu.name AS targetUserName,
|
|
|
+ r.audit_level AS auditLevel,
|
|
|
+ mu.name AS markUserName,
|
|
|
+ r.mark_time AS markTime
|
|
|
+ FROM program_issue_record r
|
|
|
+ INNER JOIN program_common_issue ci ON r.issue_id = ci.id AND ci.del_flag = 0
|
|
|
+ LEFT JOIN program_project_list_info p ON r.project_id = p.id
|
|
|
+ LEFT JOIN program_report_no prn ON prn.program_id = p.id AND prn.del_flag = '0'
|
|
|
+ LEFT JOIN sys_user tu ON r.target_user_id = tu.id
|
|
|
+ LEFT JOIN sys_user mu ON r.mark_user_id = mu.id
|
|
|
+ WHERE r.del_flag = 0
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND r.mark_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND r.mark_time <= #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="category != null and category != ''">
|
|
|
+ AND ci.category = #{category}
|
|
|
+ </if>
|
|
|
+ <if test="issueId != null and issueId != ''">
|
|
|
+ AND ci.id = #{issueId}
|
|
|
+ </if>
|
|
|
+ <if test="auditLevel != null and auditLevel != ''">
|
|
|
+ AND r.audit_level = #{auditLevel}
|
|
|
+ </if>
|
|
|
+ ORDER BY ci.category, ci.issue_name, r.mark_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按校审级别分组统计 -->
|
|
|
+ <select id="selectLevelCounts" resultType="com.jeeplus.assess.program.issueStatistics.service.dto.AuditLevelCountDTO">
|
|
|
+ SELECT
|
|
|
+ r.audit_level AS auditLevel,
|
|
|
+ COUNT(r.id) AS count
|
|
|
+ FROM program_issue_record r
|
|
|
+ WHERE r.del_flag = 0
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND r.mark_time >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND r.mark_time <= #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="issueId != null and issueId != ''">
|
|
|
+ AND r.issue_id = #{issueId}
|
|
|
+ </if>
|
|
|
+ GROUP BY r.audit_level
|
|
|
+ ORDER BY r.audit_level
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|