430 lines
13 KiB
XML
430 lines
13 KiB
XML
<?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.bonus.registration.dao.RegistrationDao">
|
|
<resultMap type="com.bonus.registration.beans.RegistrationBean" id="baseMap">
|
|
<id column="registrationId" property="registrationId"></id>
|
|
<result column="name" property="name"/>
|
|
<result column="idcard" property="idcard"/>
|
|
<result column="times" property="times"/>
|
|
<result column="specialty" property="specialty"/>
|
|
<result column="specialtyName" property="specialtyName"/>
|
|
<result column="examId" property="examId"/>
|
|
<result column="isActive" property="isActive"/>
|
|
<result column="grade" property="grade"/>
|
|
<result column="delFlag" property="delFlag"/>
|
|
</resultMap>
|
|
|
|
<sql id="baseSQL">
|
|
SELECT
|
|
sr.id as registrationId,
|
|
sr.name as name,
|
|
sr.idcard as idcard,
|
|
sr.times as times,
|
|
sr.specialty as specialty,
|
|
if(poo.id=226, CONCAT(poo.`NAME`,'/',po.`NAME`), CONCAT(pooo.`NAME`,'/',poo.`NAME`,'/',po.`NAME`)) as specialtyName
|
|
FROM
|
|
sz_registration sr
|
|
LEFT JOIN pm_organization po ON po.ID = sr.specialty
|
|
LEFT JOIN pm_organization poo ON poo.ID = po.PARENT_ID
|
|
LEFT JOIN pm_organization pooo ON pooo.ID = poo.PARENT_ID
|
|
</sql>
|
|
|
|
<update id="changeIsActive" parameterType="com.bonus.sys.beans.UserBean">
|
|
update sz_registration
|
|
set is_active = 1
|
|
where idcard = #{loginName}
|
|
</update>
|
|
|
|
<update id="toUpdateTimes" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update sz_registration
|
|
<set>
|
|
<if test="param.times != null and param.times != '' ">
|
|
times = #{param.times},
|
|
</if>
|
|
<if test="param.examId != null and param.examId != '' ">
|
|
exam_id = #{param.examId}
|
|
</if>
|
|
</set>
|
|
where idcard = #{param.idcard} and del_flag = 0
|
|
</update>
|
|
|
|
<update id="toUpdateIsActive" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update sz_registration
|
|
set is_active = 0
|
|
where idcard = #{idcard} and del_flag = 0
|
|
</update>
|
|
|
|
<select id="getnewinfoBytime" resultType="com.bonus.registration.beans.RegistrationBean">
|
|
SELECT
|
|
idcard,
|
|
name
|
|
FROM
|
|
sz_enroll
|
|
ORDER BY
|
|
date_now DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<select id="selectseatinfo" parameterType="com.bonus.registration.beans.RegistrationBean" resultType="com.bonus.registration.beans.RegistrationBean">
|
|
<!-- SELECT
|
|
pm.`NAME` AS name,
|
|
idcard,
|
|
template AS temperature,
|
|
seat AS seat,
|
|
picture,
|
|
sz.ifexam_people AS ifexamPeople
|
|
FROM
|
|
sz_seat sz
|
|
LEFT JOIN pm_user pm
|
|
ON
|
|
sz.idcard = pm.LOGIN_NAME
|
|
ORDER BY
|
|
sz.date_now DESC
|
|
LIMIT 1 -->
|
|
SELECT se.name AS name,
|
|
se.idcard ,
|
|
se.temperature AS temperature,
|
|
se.seat_num AS seat,
|
|
se.photo as picture,
|
|
se.ifexam_people as ifexamPeople
|
|
FROM sz_enroll se
|
|
ORDER BY
|
|
se.date_now DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<select id="findbynowDate" parameterType="com.bonus.registration.beans.RegistrationBean" resultType="Integer">
|
|
<!-- select count(1) from sz_seat where create_time like CONCAT('%',#{dateNow},'%') and idcard=#{idcard} -->
|
|
SELECT count(1) from sz_enroll where idcard=#{idcard}
|
|
</select>
|
|
|
|
<select id="findExamProfess" resultMap="baseMap" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
select
|
|
exam_id as examId,
|
|
profess_id as specialty
|
|
from
|
|
exam_profess
|
|
where
|
|
exam_id = #{examId} and profess_id = #{specialty}
|
|
</select>
|
|
<select id="findAlltestinfo" parameterType="com.bonus.registration.beans.RegistrationBean" resultType="com.bonus.registration.beans.RegistrationBean">
|
|
SELECT
|
|
szre.idcard,
|
|
szre.`name`,
|
|
szre.times,
|
|
exam1.grade,
|
|
CONCAT(
|
|
pooo.`NAME`,
|
|
'/',
|
|
poo.`NAME`,
|
|
'/',
|
|
po.`NAME`
|
|
) AS specialtyName
|
|
FROM
|
|
sz_registration szre
|
|
LEFT JOIN pm_organization po ON po.ID = szre.specialty
|
|
LEFT JOIN pm_organization poo ON poo.ID = po.PARENT_ID
|
|
LEFT JOIN pm_organization pooo ON pooo.ID = poo.PARENT_ID
|
|
LEFT JOIN exam_person_record exam ON exam.exam_id = szre.exam_id
|
|
LEFT JOIN exam_person_record exam1 ON exam1.user_id = szre.idcard
|
|
WHERE
|
|
szre.exam_id =#{examId}
|
|
AND szre.del_flag = '1'
|
|
</select>
|
|
<insert id="sitesave" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
<!-- insert into sz_seat(idcard, picture, template,date_now,ifexam_people,seat_name)
|
|
values(#{idcard},#{picture}, #{temperature},#{dateNow},#{ifexamPeople},#{name}) -->
|
|
INSERT INTO sz_enroll(name, idcard, photo, temperature, date_now,ifexam_people)
|
|
VALUES (#{name}, #{idcard}, #{picture},#{temperature}, #{dateNow},#{ifexamPeople})
|
|
</insert>
|
|
|
|
<insert id="insertExamProfess" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
insert into exam_profess(exam_id, profess_id, difficult_id)
|
|
values(#{examId}, #{specialty}, 1)
|
|
</insert>
|
|
|
|
<select id="findByPage" resultMap="baseMap" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
<include refid="baseSQL"/>
|
|
where
|
|
sr.del_flag = 0
|
|
<if test="param.keyWord != null and param.keyWord != '' ">
|
|
and (
|
|
sr.name LIKE CONCAT("%",#{param.keyWord},"%") or
|
|
CONCAT(pooo.`NAME`,'/',poo.`NAME`,'/',po.`NAME`) like CONCAT("%",#{param.keyWord},"%") or
|
|
sr.idcard like CONCAT("%",#{param.keyWord},"%")
|
|
)
|
|
</if>
|
|
<if test="param.times != null and param.times != '' ">
|
|
and sr.times = #{param.times}
|
|
</if>
|
|
order by sr.id DESC
|
|
</select>
|
|
|
|
<select id="findById" resultMap="baseMap" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
<include refid="baseSQL"/>
|
|
where
|
|
sr.id = #{registrationId} and sr.del_flag = 0
|
|
</select>
|
|
<select id="findByidcard" resultMap="baseMap" parameterType="java.lang.String">
|
|
<!-- <include refid="baseSQL"/>
|
|
where
|
|
sr.idcard = #{idCard}
|
|
and
|
|
sr.del_flag = 0 -->
|
|
SELECT
|
|
sr.id as registrationId,
|
|
sr.name as name,
|
|
sr.idcard as idcard,
|
|
sr.times as times,
|
|
sr.specialty as specialty
|
|
FROM
|
|
sz_registrations sr
|
|
where
|
|
sr.idcard = #{idCard}
|
|
and
|
|
sr.del_flag = 0
|
|
</select>
|
|
|
|
<select id="findUserByIdAndTimes" resultMap="baseMap" parameterType="java.lang.String">
|
|
<include refid="baseSQL"/>
|
|
where
|
|
sr.idcard = #{idCard}
|
|
and
|
|
sr.del_flag = 0
|
|
</select>
|
|
<select id="showExamPerson" resultMap="baseMap" parameterType="java.lang.String">
|
|
SELECT
|
|
sr.id AS registrationId,
|
|
sr.NAME AS NAME,
|
|
sr.idcard AS idcard,
|
|
sr.times AS times,
|
|
sr.specialty AS specialty,
|
|
CONCAT( pooo.`NAME`, '/', poo.`NAME`, '/', po.`NAME` ) AS specialtyName,
|
|
sr.is_active as isActive,
|
|
pu.ID as userId
|
|
FROM
|
|
sz_registration sr
|
|
LEFT JOIN pm_organization po ON po.ID = sr.specialty
|
|
LEFT JOIN pm_organization poo ON poo.ID = po.PARENT_ID
|
|
LEFT JOIN pm_organization pooo ON pooo.ID = poo.PARENT_ID
|
|
LEFT JOIN pm_user pu ON pu.LOGIN_NAME = sr.idcard
|
|
WHERE
|
|
sr.del_flag = 0
|
|
</select>
|
|
|
|
<select id="showExamingPerson" resultMap="baseMap" parameterType="java.lang.String">
|
|
select
|
|
ep.exam_id AS examId,
|
|
sr.NAME AS NAME,
|
|
sr.idcard AS idcard,
|
|
sr.times AS times,
|
|
sr.specialty AS specialty,
|
|
sr.is_active as isActive
|
|
from
|
|
exam_paper ep
|
|
left join sz_registration sr on sr.times = ep.exam_count
|
|
where ep.exam_id = #{id} and sr.del_flag = 0
|
|
</select>
|
|
|
|
<select id="findExamPerson" resultMap="baseMap" parameterType="java.lang.String">
|
|
select
|
|
ep.exam_id AS examId,
|
|
pu.NAME AS NAME,
|
|
epr.user_id AS idcard,
|
|
ep.exam_count AS times,
|
|
epr.profess_id AS specialty,
|
|
1 as isActive,
|
|
epr.grade AS grade,
|
|
if(poo.id=226, CONCAT(poo.`NAME`,'/',po.`NAME`), CONCAT(pooo.`NAME`,'/',poo.`NAME`,'/',po.`NAME`)) as specialtyName
|
|
from
|
|
exam_person_record epr
|
|
left join pm_user pu on pu.LOGIN_NAME = epr.user_id
|
|
left join exam_paper ep on ep.exam_id = epr.exam_id
|
|
left join pm_organization po ON po.ID = epr.profess_id
|
|
left join pm_organization poo ON poo.ID = po.PARENT_ID
|
|
left join pm_organization pooo ON pooo.ID = poo.PARENT_ID
|
|
where ep.exam_id = #{id} and epr.user_id not in (
|
|
select idcard from sz_registration
|
|
where del_flag = 0 and times = ep.exam_count
|
|
)
|
|
</select>
|
|
|
|
<select id="findExamingPerson" resultMap="baseMap" parameterType="com.bonus.seat.beans.SeatBean">
|
|
SELECT
|
|
ex.exam_id AS examId,
|
|
sr.idcard as idcard
|
|
FROM
|
|
exam_paper ex
|
|
LEFT JOIN sz_registration sr ON sr.times = ex.exam_count
|
|
WHERE
|
|
sr.del_flag = 0
|
|
AND ex.is_active != 2
|
|
AND ex.exam_id = #{examId}
|
|
</select>
|
|
<select id="showPersonScoreResult" resultMap="baseMap" parameterType="java.lang.String">
|
|
SELECT
|
|
sr.id AS registrationId,
|
|
sr.NAME AS NAME,
|
|
sr.idcard AS idcard,
|
|
sr.del_flag AS delFlag,
|
|
sr.is_active AS isActive,
|
|
sr.times as times
|
|
FROM
|
|
sz_registration sr
|
|
WHERE
|
|
sr.exam_id = #{id}
|
|
</select>
|
|
|
|
<select id="findMissingTest" resultMap="baseMap" parameterType="java.lang.String">
|
|
select
|
|
ep.exam_id AS examId,
|
|
pu.NAME AS NAME,
|
|
sm.idcard AS idcard,
|
|
ep.exam_count AS times,
|
|
pu.ORG_ID AS specialty,
|
|
0 AS isActive
|
|
from sz_missingtest sm
|
|
left join exam_paper ep on ep.exam_id = sm.exam_id
|
|
left join pm_user pu on pu.LOGIN_NAME = sm.idcard
|
|
where sm.exam_id = #{id}
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="com.bonus.question.beans.QuestionBean" useGeneratedKeys="true" keyProperty="registrationId" keyColumn="id">
|
|
insert into
|
|
sz_registration (
|
|
name
|
|
<if test="idcard != null and idcard != ''">
|
|
,idcard
|
|
</if>
|
|
<if test="times != null and times != ''">
|
|
,times
|
|
</if>
|
|
<if test="specialty != null and specialty != ''">
|
|
,specialty
|
|
</if>
|
|
)
|
|
values (
|
|
#{name}
|
|
<if test="idcard != null and idcard != ''">
|
|
,#{idcard}
|
|
</if>
|
|
<if test="times != null and times != ''">
|
|
,#{times}
|
|
</if>
|
|
<if test="specialty != null and specialty != ''">
|
|
,#{specialty}
|
|
</if>
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertMissingTest" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
insert into sz_missingtest(exam_id, idcard)
|
|
values(#{examId}, #{idcard})
|
|
</insert>
|
|
|
|
<select id="judgeExamPerson" parameterType="com.bonus.sys.beans.UserBean" resultMap="baseMap">
|
|
select
|
|
is_active as isActive
|
|
from sz_registration
|
|
where
|
|
idcard = #{loginName} and del_flag = 0
|
|
</select>
|
|
|
|
<update id="updatebyidcard" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update
|
|
sz_enroll
|
|
<set>
|
|
<if test="picture != null and picture != ''">
|
|
photo = #{picture},
|
|
</if>
|
|
<if test="temperature != null and temperature != ''">
|
|
template = #{temperature},
|
|
</if>
|
|
<if test="dateNow != null and dateNow != ''">
|
|
date_now =#{dateNow},
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
name = #{name}
|
|
</if>
|
|
|
|
</set>
|
|
where
|
|
idcard = #{idcard} and is_active='1'
|
|
|
|
</update>
|
|
|
|
<update id="updateEnroll" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update
|
|
sz_enroll
|
|
<set>
|
|
<if test="picture != null and picture != ''">
|
|
photo = #{picture},
|
|
</if>
|
|
<if test="temperature != null and temperature != ''">
|
|
temperature = #{temperature},
|
|
</if>
|
|
|
|
<if test="dateNow != null and dateNow != ''">
|
|
date_now = #{dateNow},
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
name = #{name}
|
|
</if>
|
|
|
|
</set>
|
|
where
|
|
idcard = #{idcard} and is_active='1'
|
|
|
|
</update>
|
|
|
|
|
|
<select id="findnameByidcard" parameterType="String" resultType="com.bonus.registration.beans.RegistrationBean">
|
|
SELECT
|
|
sz.id as registrationId,
|
|
sz.seat_name as name
|
|
FROM
|
|
sz_seat sz
|
|
WHERE
|
|
sz.idcard = #{0}
|
|
AND sz.seat_name IS NOT NULL
|
|
</select>
|
|
|
|
<update id="setExamId" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update
|
|
sz_registration
|
|
set
|
|
exam_id = #{examId}
|
|
where
|
|
del_flag = 0
|
|
AND
|
|
idcard = #{idcard}
|
|
</update>
|
|
|
|
<update id="update" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update
|
|
sz_registration
|
|
<set>
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="idcard != null and idcard != ''">
|
|
idcard = #{idcard},
|
|
</if>
|
|
<if test="times != null and times != ''">
|
|
times = #{times},
|
|
</if>
|
|
<if test="specialty != null and specialty != ''">
|
|
specialty = #{specialty},
|
|
</if>
|
|
</set>
|
|
where
|
|
id = #{registrationId}
|
|
</update>
|
|
|
|
<update id="deleteApply" parameterType="com.bonus.registration.beans.RegistrationBean">
|
|
update sz_registration
|
|
set del_flag = 1
|
|
where id = #{registrationId}
|
|
</update>
|
|
|
|
</mapper> |