|
|
@ -209,4 +209,141 @@ |
|
|
|
t.NAME , |
|
|
|
t.NAME , |
|
|
|
q.question_types |
|
|
|
q.question_types |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getExamDetailAnalysisPageList" resultType="java.util.Map"> |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
scores.exam_id as examId, |
|
|
|
|
|
|
|
info.exam_name as examName, |
|
|
|
|
|
|
|
papers.paper_name as paperName, |
|
|
|
|
|
|
|
CASE |
|
|
|
|
|
|
|
WHEN INSTR ( info.exam_region, '/' ) > 0 THEN |
|
|
|
|
|
|
|
SUBSTRING ( info.exam_region, INSTR ( info.exam_region, '/' ) + 1 ) ELSE info.exam_region |
|
|
|
|
|
|
|
END AS examArea, |
|
|
|
|
|
|
|
ind.industry_name AS industry, |
|
|
|
|
|
|
|
COUNT ( scores."id" ) AS "participants", |
|
|
|
|
|
|
|
AVG ( scores.exam_time_spent ) AS "averageTime", |
|
|
|
|
|
|
|
<![CDATA[ |
|
|
|
|
|
|
|
round( |
|
|
|
|
|
|
|
SUM ( CASE WHEN scores.total_score / papers.total_score >= 0.6 THEN 1 ELSE 0 END ) / COUNT ( scores."id" ) * 100, |
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
) || '%' AS "passRate" |
|
|
|
|
|
|
|
]]> |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
ex_exam_scores AS scores |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_info AS info ON info.ID = scores.exam_id |
|
|
|
|
|
|
|
AND info.paper_id = scores.paper_id |
|
|
|
|
|
|
|
AND info.is_deleted = 0 |
|
|
|
|
|
|
|
AND info.publish_status = 1 |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_papers papers ON papers.ID = scores.paper_id |
|
|
|
|
|
|
|
AND papers.is_deleted = 0 |
|
|
|
|
|
|
|
AND papers.paper_status = 1 |
|
|
|
|
|
|
|
LEFT JOIN tbl_industry ind ON ind.industry_id = info.industry_id |
|
|
|
|
|
|
|
AND ind.status = 1 |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
scores.is_deleted = 0 |
|
|
|
|
|
|
|
<if test="examName != null and examName != ''"> |
|
|
|
|
|
|
|
AND info.exam_name LIKE '%' + #{examName} + '%' |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="paperName != null and paperName != ''"> |
|
|
|
|
|
|
|
AND paper.paper_name LIKE '%' + #{paperName} + '%' |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="industry != null and industry != ''"> |
|
|
|
|
|
|
|
AND ind.industry_id = #{industry} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="examArea != null and examArea != ''"> |
|
|
|
|
|
|
|
AND info.exam_region = #{examArea} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
GROUP BY |
|
|
|
|
|
|
|
info.exam_name, |
|
|
|
|
|
|
|
papers.paper_name, |
|
|
|
|
|
|
|
ind.industry_name, |
|
|
|
|
|
|
|
info.exam_region, |
|
|
|
|
|
|
|
scores.exam_id, |
|
|
|
|
|
|
|
scores.paper_id |
|
|
|
|
|
|
|
ORDER BY |
|
|
|
|
|
|
|
scores.exam_id, |
|
|
|
|
|
|
|
scores.paper_id |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getScoreDistribution" resultType="java.util.Map"> |
|
|
|
|
|
|
|
<![CDATA[ |
|
|
|
|
|
|
|
-- 定义 CTE scores,用于获取考试成绩相关信息 |
|
|
|
|
|
|
|
WITH scores AS ( |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
score.total_score, |
|
|
|
|
|
|
|
papers.total_score, |
|
|
|
|
|
|
|
score.total_score / papers.total_score AS grade, |
|
|
|
|
|
|
|
info.ID |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
ex_exam_scores score |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_info info ON info.ID = score.exam_id |
|
|
|
|
|
|
|
AND info.publish_status = 1 |
|
|
|
|
|
|
|
AND info.is_deleted = 0 |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_papers papers ON papers.ID = info.paper_id |
|
|
|
|
|
|
|
AND papers.is_deleted = 0 |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
score.is_deleted = 0 |
|
|
|
|
|
|
|
and score.exam_id = #{id} |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
-- 定义 CTE total,用于计算总人数 |
|
|
|
|
|
|
|
total AS ( |
|
|
|
|
|
|
|
SELECT count(1) headcount |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
ex_exam_scores score |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_info info ON info.ID = score.exam_id |
|
|
|
|
|
|
|
AND info.publish_status = 1 |
|
|
|
|
|
|
|
AND info.is_deleted = 0 |
|
|
|
|
|
|
|
LEFT JOIN ex_exam_papers papers ON papers.ID = info.paper_id |
|
|
|
|
|
|
|
AND papers.is_deleted = 0 |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
score.is_deleted = 0 |
|
|
|
|
|
|
|
and score.exam_id = #{id} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
-- 主查询部分,计算不同成绩区间的比例并精确到小数点后两位 |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) AS "value" , |
|
|
|
|
|
|
|
'优秀占比: '||ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) || '%' AS "name" |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
scores |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
grade >= 0.9 |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) AS "value" , |
|
|
|
|
|
|
|
'合格占比: '||ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) || '%'AS "name" |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
scores |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
grade < 0.9 |
|
|
|
|
|
|
|
AND grade >= 0.6 |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
|
|
ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) AS "value" , |
|
|
|
|
|
|
|
'需努力占比: '||ROUND(COUNT(1) / (SELECT headcount FROM total) * 100, 2) || '%'AS "name" |
|
|
|
|
|
|
|
FROM |
|
|
|
|
|
|
|
scores |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
grade < 0.6; |
|
|
|
|
|
|
|
]]> |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getPaperAnalysisData" resultType="java.lang.Integer"> |
|
|
|
|
|
|
|
select |
|
|
|
|
|
|
|
count(1) |
|
|
|
|
|
|
|
from |
|
|
|
|
|
|
|
ex_exam_papers |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
is_deleted = 0 |
|
|
|
|
|
|
|
<if test="status != null and status != ''"> |
|
|
|
|
|
|
|
AND paper_status = #{status} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="getPaperAnalysisData" resultType="java.lang.Integer"> |
|
|
|
|
|
|
|
select |
|
|
|
|
|
|
|
count(1) |
|
|
|
|
|
|
|
from |
|
|
|
|
|
|
|
ex_exam_papers |
|
|
|
|
|
|
|
WHERE |
|
|
|
|
|
|
|
is_deleted = 0 |
|
|
|
|
|
|
|
<if test="status != null and status != ''"> |
|
|
|
|
|
|
|
AND paper_status = #{status} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|
</mapper> |