GROUP_CONCAT( u.user_name ORDER BY u.user_name SEPARATOR ', ' ) AS evaluators,
ra.report_id
FROM
nakadai.r_evaluation_assignments ra
LEFT JOIN nakadai.hr_user_account a ON a.id = ra.account_id
LEFT JOIN nakadai.hr_user_info u ON u.user_id = a.user_id
GROUP BY
ra.report_id
) SELECT
r.paper_id,
p.province_name,
p.province_name,
c.city_name,
c.city_name,
p.province_id,
p.province_id,
@ -531,14 +544,26 @@
r.time_sum,
r.time_sum,
r.score,
r.score,
r.submit_time,
r.submit_time,
s.school_name,
s.school_name AS realSchool,
a.school_id AS realSchoolId,
paper.NAME AS submitName,
paper.NAME AS submitName,
0 as isDistribution,
v.allocate_time AS latestDistributionTime,
'测试_Rong' as evaluator,
v.latest_assignor AS latestDistributionUser,
1 as evaluatorCount,
COALESCE ( e.evaluators, '' ) AS evaluator,
now() as latestDistributionTime,
CASE
'测试_Rong' as latestDistributionUser
WHEN ( SELECT count( 1 ) FROM nakadai.r_evaluation_assignments a WHERE a.report_id = r.report_id ) = v.reviewers_per_question THEN
1 ELSE 0
END AS isDistribution,
e.evaluator_count,
e1.any_pending,
CASE
WHEN e1.any_pending = 1 THEN
'待评阅'
WHEN e1.any_pending IS NULL THEN
'待评阅' ELSE '已评阅'
END AS evaluationStatus
FROM
FROM
occupationlab.ol_experimental_report r
occupationlab.ol_experimental_report r
LEFT JOIN nakadai.hr_user_account a ON a.id = r.account_id
LEFT JOIN nakadai.hr_user_account a ON a.id = r.account_id
@ -548,15 +573,122 @@
LEFT JOIN nakadai.city c ON c.province_id = s.province_id
LEFT JOIN nakadai.city c ON c.province_id = s.province_id
AND c.city_id = s.city_id
AND c.city_id = s.city_id
LEFT JOIN exam.exam_paper paper ON paper.paper_id = r.paper_id
LEFT JOIN exam.exam_paper paper ON paper.paper_id = r.paper_id
LEFT JOIN nakadai.r_evaluation v ON v.assessment_id = r.assessment_id
LEFT JOIN EvaluatorCTE e ON e.evaluation_id = v.evaluation_id and e.report_id = r.report_id
LEFT JOIN ( SELECT report_id, MAX( CASE WHEN STATUS = '待评阅' THEN 1 ELSE 0 END ) AS any_pending FROM r_evaluation_assignments GROUP BY report_id ) e1 ON e1.report_id = r.report_id
WHERE
WHERE
r.assessment_id = #{req.assessmentId}
r.assessment_id = #{req.assessmentId}
AND a.type = 1
AND r.is_del = 0
AND r.is_del = 0
<iftest="req.keyword != null and req.keyword != ''">
<iftest="req.keyword != null and req.keyword != ''">
AND (
AND (
u.user_name LIKE CONCAT( '%', #{req.keyword}, '%' )
u.user_name LIKE CONCAT( '%', #{req.keyword}, '%' )
OR a.work_number LIKE CONCAT( '%', #{req.keyword}, '%' )
OR a.work_number LIKE CONCAT( '%', #{req.keyword}, '%' )
INNER JOIN nakadai.hr_user_account ua ON ua.id = r.account_id
WHERE
ua.type = 1
GROUP BY
r.assessment_id
),
AssignmentCounts AS (
SELECT
assessment_id,
account_id,
SUM( CASE WHEN STATUS = '待评阅' THEN 1 ELSE 0 END ) AS unReviewedAnswer,
SUM( CASE WHEN STATUS = '已评阅' THEN 1 ELSE 0 END ) AS reviewedAnswer
FROM
nakadai.r_evaluation_assignments
GROUP BY
assessment_id,
account_id
) SELECT
ass.experimental_name AS competitionName,
p.NAME AS competitionContent,
a.account_id,
a.paper_id,
a.report_id,
a.task_type,
a.STATUS,
a.assessment_id,
e.start_time,
e.end_time,
rc.totalAnswer,
ac.unReviewedAnswer,
ac.reviewedAnswer,
CASE
WHEN rc.totalAnswer != ( ac.unReviewedAnswer + ac.reviewedAnswer ) THEN
0
WHEN ac.unReviewedAnswer = 0 THEN
1 ELSE 0
END AS reviewStatus,
CASE
WHEN e.is_timed = 0 THEN
'1'
WHEN CURRENT_TIMESTAMP <![CDATA[ <]]> e.start_time THEN '0' WHEN CURRENT_TIMESTAMP BETWEEN e.start_time AND e.end_time THEN '1' WHEN CURRENT_TIMESTAMP > e.end_time THEN
'2' ELSE NULL
END AS reviewStage
FROM
nakadai.r_evaluation_assignments a
INNER JOIN occupationlab.ol_assessment ass ON ass.id = a.assessment_id
LEFT JOIN exam.exam_paper p ON p.paper_id = a.paper_id
LEFT JOIN nakadai.r_evaluation e ON e.evaluation_id = a.evaluation_id
LEFT JOIN ReportCounts rc ON rc.assessment_id = a.assessment_id
LEFT JOIN AssignmentCounts ac ON ac.assessment_id = a.assessment_id