<?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="org.springblade.modules.signinrecords.mapper.SignInRecordsMapper">
|
|
<!--查詢考試簽到記錄分頁數據-->
|
<select id="selectSignInRecordsPage" resultType="org.springblade.modules.signinrecords.vo.SignInRecordsVo">
|
select
|
ssir.*,
|
bu.real_name realName,
|
bu.cardid idCardNo,
|
bd.dept_name deptName
|
from sys_sign_in_records ssir
|
left join
|
blade_user bu
|
on
|
bu.id = ssir.user_id
|
left join
|
blade_dept bd
|
on
|
bu.dept_id = bd.id
|
left join
|
sys_training_registration str
|
on
|
str.id = ssir.apply_id
|
where 1=1
|
<if test="signInRecords.realName!=null and signInRecords.realName!=''">
|
and bu.real_name like concat('%',#{signInRecords.realName},'%')
|
</if>
|
<if test="signInRecords.idCardNo!=null and signInRecords.idCardNo!=''">
|
and bu.cardid like concat('%',#{signInRecords.idCardNo},'%')
|
</if>
|
<if test="signInRecords.deptName!=null and signInRecords.deptName!=''">
|
and bd.dept_name like concat('%',#{signInRecords.deptName},'%')
|
</if>
|
<if test="signInRecords.signTime!=null and signInRecords.signTime!=''">
|
and date_format(ssir.update_time,'%Y-%m-%d') = #{signInRecords.signTime}
|
</if>
|
<if test="signInRecords.trainingUnitId!=null and signInRecords.trainingUnitId!=''">
|
and str.training_unit_id = #{signInRecords.trainingUnitId}
|
</if>
|
order by ssir.id desc
|
</select>
|
|
|
<select id="getSignStatisticsPie" resultType="org.springblade.modules.signinrecords.vo.SignStatistics">
|
SELECT
|
basic.shouldNum,basic.realNum,(basic.shouldNum-basic.realNum) as unArriveNum,
|
(basic.realNum/basic.shouldNum) as sign,((basic.shouldNum-basic.realNum)/basic.shouldNum) as unSign
|
FROM(
|
SELECT
|
(SELECT COUNT(*) FROM sys_training_registration
|
WHERE
|
cancel = '1' and audit_status = '1'
|
<if test="statistics.examId != null and statistics.examId !='' ">
|
AND train_exam_id = #{statistics.examId}
|
</if>
|
) as shouldNum,
|
(SELECT COUNT(*) FROM sys_sign_in_records
|
WHERE 1=1
|
<if test="statistics.examId != null and statistics.examId !='' ">
|
AND exam_id = #{statistics.examId}
|
</if>
|
) as realNum
|
)basic
|
</select>
|
|
|
<select id="getSignStatisticsBar" resultType="org.springblade.modules.signinrecords.vo.SignStatistics">
|
SELECT
|
shouldTemp.shouldNum,
|
realTemp.realNum,
|
shouldTemp.shouldNum - realTemp.realNum AS unArriveNum,
|
shouldTemp.dept_name
|
FROM
|
(
|
SELECT
|
COUNT(*) shouldNum,
|
bd.dept_name,
|
bd.id
|
FROM
|
sys_training_registration str
|
LEFT JOIN blade_user bu ON bu.id = str.user_id
|
LEFT JOIN blade_dept bd ON bd.id = bu.dept_id
|
WHERE 1=1
|
<if test="statistics.examId != null and statistics.examId !='' ">
|
AND str.train_exam_id = #{statistics.examId}
|
</if>
|
GROUP BY
|
bd.dept_name,
|
bd.id
|
ORDER BY
|
dept_name DESC
|
) shouldTemp
|
LEFT JOIN (
|
SELECT
|
COUNT(*) realNum,
|
bd.dept_name,
|
bd.id
|
FROM
|
sys_sign_in_records ssir
|
LEFT JOIN blade_user bu ON bu.id = ssir.user_id
|
LEFT JOIN blade_dept bd ON bd.id = bu.dept_id
|
WHERE
|
1=1
|
<if test="statistics.examId != null and statistics.examId !='' ">
|
AND ssir.exam_id = #{statistics.examId}
|
</if>
|
GROUP BY
|
bd.dept_name,
|
bd.id
|
ORDER BY
|
dept_name DESC
|
) realTemp ON shouldTemp.id = realTemp.id
|
</select>
|
<select id="getSignSituationList" resultType="org.springblade.modules.signinrecords.vo.SignInfo">
|
SELECT
|
str.candidate_no,
|
bu.avatar,
|
bu.real_name,
|
bu.cardId,
|
str.train_exam_id as examId,
|
bu.sex,
|
CASE WHEN ssir.id IS NULL THEN
|
'未签到' ELSE '已签到'
|
END AS state
|
FROM
|
sys_training_registration str
|
LEFT JOIN blade_user bu ON bu.id = str.user_id
|
LEFT JOIN sys_sign_in_records ssir ON ssir.candidate_no = str.candidate_no
|
<if test="signInfo.examId != null and signInfo.examId !='' ">
|
AND ssir.exam_id = #{signInfo.examId}
|
</if>
|
WHERE str.audit_status = '1' and str.cancel = '1'
|
<if test="signInfo.examId != null and signInfo.examId !='' ">
|
and str.train_exam_id = #{signInfo.examId}
|
</if>
|
ORDER BY str.candidate_no ASC
|
</select>
|
|
</mapper>
|