select
count(1) totalCount,
sum(case
when t.status='SCANNED' then 1 else 0 end)
scannedCount,
sum(case when
t.status='UNEXIST' then 1 else 0 end)
unexistCount,
sum(case when
t.status='MANUAL_ABSENT' then 1 else 0 end)
manualAbsentCount,
sum(case
when t.omr_absent=1 then 1 else 0 end)
omrAbsentCount,
sum(case when
t.absent_suspect=1 then 1 else 0 end)
absentSuspectCount
from sc_student t
where t.exam_id=#{examId}
and t.${groupType}=#{groupName}
group by t.exam_id
, t.${groupType}
select tem.groupName from (
) tem
select tem.* from (
) tem
select tem.* from (
) tem
select
t.*,
c.paper_count cardPaperCount,
s.name subjectName
from sc_student t
left join sc_answer_card c on t.exam_id=c.exam_id and
t.card_number=c.number
left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
order by t.id
select
t.exam_number
from sc_student t
left join sc_subject s on s.exam_id=t.exam_id and s.code=t.subject_code
order by t.id
select
t.*,
s.name subjectName,
(select count(sp.paper_id) from sc_student_paper sp where sp.student_id=t.id)
as paperCount
from sc_student t
left join sc_subject s on s.code = t.subject_code and s.exam_id =
t.exam_id
order by t.id
select t.*
from sc_student t
inner join sc_exam e on t.exam_id = e.id
where e.enable_upload = 1
and e.enable = 1
and (t.file_upload_status = 'WAITING_UPLOAD' or t.data_upload_status =
'WAITING_UPLOAD')
limit #{pageSize}
select t.*
from sc_student t
inner join sc_exam e on t.exam_id = e.id
where e.enable_upload = 1
and e.enable = 1
and (t.file_upload_status = 'ERROR' or t.data_upload_status = 'ERROR')
limit #{pageSize}
select count(distinct t.package_code)
from sc_student t
where t.exam_id = #{examId}
select count(*) from sc_student t
where t.exam_id=#{query.examId}
and t.exam_number=#{query.examNumber}
and t.name=#{query.name}
and t.package_code=#{query.packageCode}
and t.campus_name=#{query.campusName}
and t.subject_code=#{query.subjectCode}
and t.exam_site=#{query.examSite}
and t.exam_room=#{query.examRoom}
and t.seat_number=#{query.seatNumber}
and t.status=#{query.scanStatus}
select sb.code as subject_code, sb.name as subjectName
,(select count(1) from sc_student stu where stu.exam_id=sb.exam_id and stu.subject_code = sb.code) studentCount
from sc_subject sb
where sb.exam_id = #{examId}
select
t.id,
t.exam_number,
t.student_code,
t.name,
t.subject_code,
s.name subjectName,
t.package_code,
t.campus_name,
t.campus_code,
t.exam_site,
t.exam_site_name,
t.exam_room,
t.seat_number
from sc_student t
left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
where t.exam_id=#{query.examId}
and t.exam_number=#{query.examNumber}
and t.name=#{query.name}
and t.package_code=#{query.packageCode}
and t.campus_name=#{query.campusName}
and t.subject_code=#{query.subjectCode}
and t.exam_site=#{query.examSite}
and t.exam_room=#{query.examRoom}
and t.seat_number=#{query.seatNumber}
and t.status=#{query.scanStatus}
order by t.id
select t.*,
e.mode
from sc_student t
inner join sc_exam e on t.exam_id = e.id
where e.enable = 1
and e.mode = 'CET'
and t.file_upload_status = 'WAITING_UPLOAD'
limit #{pageSize}
select count(1)
from sc_student t
where t.exam_id = #{examId}
and t.file_upload_status = 'UPLOADED'
and t.data_upload_status = 'UPLOADED'
select count(1)
from sc_student t
where t.exam_id = #{examId}
and (
t.file_upload_status in ('WAITING_UPLOAD', 'ERROR') or
t.data_upload_status in ('WAITING_UPLOAD', 'ERROR')
)
select t.*
from sc_student t
where t.exam_id = #{query.examId}
and t.subject_code=#{query.subjectCode}
and t.status = 'SCANNED'
and t.file_upload_status = 'UPLOADED'
order by t.id
select count(1)
from sc_student t
where t.exam_id = #{query.examId}
and t.subject_code=#{query.subjectCode}
and t.status = 'SCANNED'
and t.file_upload_status = 'UPLOADED'
select count(1) as totalCount,
count(case when t.absent_suspect = 1 then 1 end) as absentSuspectCount,
count(case when t.assigned = 1 then 1 end) as assignedCount,
count(case when t.omr_absent = 1 then 1 end) as omrAbsentCount,
count(case when t.incomplete = 1 then 1 end) as incompleteCount,
count(case when t.status = 'MANUAL_ABSENT' then 1 end) as manualAbsentCount,
count(case when t.status = 'SCANNED' then 1 end) as scannedCount,
count(case when t.status = 'UNEXIST' then 1 end) as unexistCount
from sc_student t
where t.exam_id = #{examId}
where t.exam_id=#{query.examId}
AND t.status in
#{st}
and t.exam_status=#{query.examStatus}
and t.exam_number =#{query.examNumber}
and t.name=#{query.name}
and t.package_code=#{query.packageCode}
and t.campus_name=#{query.campusName}
and t.campus_code=#{query.campusCode}
and t.subject_code=#{query.subjectCode}
and t.exam_site=#{query.examSite}
and t.exam_room=#{query.examRoom}
and t.province=#{query.province}
and t.absent_suspect=#{query.absentSuspect}
and t.omr_absent=#{query.omrAbsent}
and t.assigned=#{query.assigned}
and t.incomplete=#{query.incomplete}
and t.question_filled=#{query.questionFilled}
and t.subjective_filled=#{query.subjectiveFilled}
and t.device=#{query.device}
and t.assigned_check_count=#{query.assignedCheckCount}
and t.assigned_suspect=#{query.assignedSuspect}
and t.paper_type!='#' and t.paper_type!='?'
and t.paper_type='#'
and t.paper_type='?'
select
#{query.groupType} groupType,
t.${groupNameCol} groupName,
count(1) totalCount,
sum(case
when t.status='SCANNED' then 1 else 0 end)
scannedCount,
sum(case when
t.status='UNEXIST' then 1 else 0 end)
unexistCount,
sum(case when
t.status='MANUAL_ABSENT' then 1 else 0 end)
manualAbsentCount,
sum(case
when t.omr_absent=1 then 1 else 0 end)
omrAbsentCount,
sum(case when
t.absent_suspect=1 then 1 else 0 end)
absentSuspectCount
from sc_student t
where
t.exam_id=#{query.examId}
and t.${groupNameCol} is not null
and t.campus_code=#{query.campusCode}
and t.subject_code=#{query.subjectCode}
and t.exam_site=#{query.examSite}
and t.exam_room=#{query.examRoom}
group by t.${groupNameCol}
where 1=1
and (1=2
or tem.unexistCount>0
or tem.manualAbsentCount>0
or tem.omrAbsentCount>0
or tem.absentSuspectCount>0
)
and tem.scannedCount>0
and tem.scannedCount=0
order by tem.groupName
select t.*
from sc_student t
order by t.id
select
t.*,
s.name subjectName,
h.user_id auditorId
from sc_student t
left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
left join (
SELECT MAX(id) id,student_id FROM sc_assigned_check_history h GROUP BY student_id
) m on t.id=m.student_id
left join sc_assigned_check_history h on h.id=m.id and h.student_id=t.id
and h.user_id = #{query.auditorId}
and t.update_time >= #{query.startTime}
and t.update_time <= #{query.endTime}
order by t.id
select t.*,
c.paper_count cardPaperCount,
s.name subjectName
from sc_student t
left join sc_answer_card c on t.exam_id = c.exam_id and
t.card_number = c.number
left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
where t.exam_id = #{examId}
and t.subject_code = #{subjectCode}
and t.assigned_check_count = #{checkCount}
and t.assigned = 1
order by t.id
select t.*,
c.paper_count cardPaperCount,
s.name subjectName
from sc_assigned_check_history h
left join sc_student t on t.id = h.student_id
left join sc_answer_card c on t.exam_id = c.exam_id and
t.card_number = c.number
left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
where h.user_id = #{userId}
and h.exam_id = #{examId}
and h.subject_code = #{subjectCode}
order by h.id desc
UPDATE sc_student
SET assigned_check_count = (SELECT count(1)
FROM sc_assigned_check_history h
WHERE h.student_id = #{id})
WHERE id = #{id}
select t.subject_code,s.name subject_name,
sum(case when t.status='UNEXIST' then 1 else 0 end) unexistCount,
count(1) studentCount
from sc_student t
inner join sc_subject s on t.exam_id=s.exam_id and t.subject_code=s.code
where t.exam_id=#{examId}
and t.subject_code=#{subjectCode}
group by t.subject_code
select t.*,ss.device_name,su.name subjectName
from sc_student t
left join sc_scanner ss on t.device=ss.device
left join sc_subject su on t.exam_id=su.exam_id and t.subject_code=su.code
where t.exam_id=#{req.examId}
and t.campus_code=#{req.campusCode}
and t.exam_number=#{req.examNumber}
and t.subject_code=#{req.subjectCode}
and t.exam_site=#{req.examSite}
and t.name like concat('%',#{req.name}, '%')
and t.package_code=#{req.packageCode}
select
t.*,
s.name subjectName
from sc_student t
left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
order by t.exam_number
select tm.* from (select t.campus_code,t.exam_site,t.exam_site_name,t.exam_room,
s.code subject_code,
s.name subject_name
from sc_student t
left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
group by t.campus_code,t.exam_site,t.exam_room,s.code
) tm
order by tm.exam_site,tm.exam_room
select id
from sc_student
where exam_id = #{examId}
and file_upload_status = 'UPLOADED'
and image_check_status in ('WAITING', 'FAILED')
and id > #{startId}
order by id
limit #{batchSize}
select stu.subject_code,
sb.name as subjectName,
count(1) as totalCount,
sum(case
when
(stu.file_upload_status = 'ERROR')
or (stu.file_upload_status = 'UPLOADED' and stu.image_check_status in('SUCCESS','FAILED') )
then 1
else 0 end) disposedCount,
sum(case
when stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED' then 1
else 0 end) failedCount
from sc_student stu
inner join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
where stu.exam_id = #{examId}
group by stu.subject_code
select stu.subject_code,
sb.name as subject_name,
stu.campus_code,
stu.campus_name,
stu.exam_site,
stu.exam_site_name,
stu.exam_room,
stu.image_check_status,
sum(case when stu.file_upload_status='ERROR' or stu.image_check_status = 'FAILED' then 1 else 0 end)
failedCount
from sc_student stu
inner join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
where stu.exam_id = #{query.examId}
and stu.subject_code = #{query.subjectCode}
and (stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED')
group by stu.exam_room
select stu.subject_code,
sb.name as subject_name,
stu.campus_code,
stu.campus_name,
stu.exam_site,
stu.exam_site_name,
stu.exam_room
from sc_student stu
left join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
where stu.exam_id = #{examId}
and stu.subject_code = #{subjectCode}
and stu.assigned = 1
and stu.assigned_suspect = 1
group by stu.exam_room
select t.*,
c.paper_count cardPaperCount,
s.name subjectName
from sc_student t
left join sc_answer_card c on t.exam_id = c.exam_id and
t.card_number = c.number
left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
where t.id = #{studentId}
select count(*)
from sc_student stu
where stu.exam_id = #{examId}
and stu.subject_code = #{subjectCode}
and (stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED')
select count(*)
from sc_student stu
where stu.exam_id = #{examId}
and stu.subject_code = #{subjectCode}
and ((stu.file_upload_status = 'ERROR')
or (stu.file_upload_status = 'UPLOADED' and stu.image_check_status in('SUCCESS','FAILED')) )
select stu.id
from sc_student stu
where stu.exam_id = #{examId}
and stu.subject_code = #{subjectCode}
and (
stu.file_upload_status in('WAITING_UPLOAD','ERROR')
or
(stu.file_upload_status='UPLOADED' and stu.image_check_status in('WAITING','FAILED') )
)
limit 1
where t.exam_id=#{query.examId}
AND t.status in
#{st}
AND t.exam_status in
#{st}
and t.exam_number in
#{en}
and t.name=#{query.name}
and t.package_code=#{query.packageCode}
and t.campus_name=#{query.campusName}
and t.campus_code=#{query.campusCode}
and t.subject_code=#{query.subjectCode}
and t.exam_site=#{query.examSite}
and t.exam_room=#{query.examRoom}
and t.province=#{query.province}
and t.absent_suspect=#{query.absentSuspect}
and t.omr_absent=#{query.omrAbsent}
and t.assigned=#{query.assigned}
and t.incomplete=#{query.incomplete}
and t.question_filled=#{query.questionFilled}
and t.subjective_filled=#{query.subjectiveFilled}
and t.device=#{query.device}
and t.assigned_check_count=#{query.assignedCheckCount}
and t.assigned_suspect=#{query.assignedSuspect}
and t.paper_type!='#' and t.paper_type!='?'
and t.paper_type='#'
and t.paper_type='?'
and (t.question_filled=1 or t.subjective_filled=1)
and t.question_filled=0 and t.subjective_filled=0