269 lines
7.0 KiB
XML
269 lines
7.0 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.seat.dao.SeatDao">
|
|
<resultMap type="com.bonus.seat.beans.SeatBean" id="baseMap">
|
|
<id column="seatId" property="seatId"/>
|
|
<result column="seatNum" property="seatNum"/>
|
|
<result column="seatIp" property="seatIp"/>
|
|
<result column="roomId" property="roomId"/>
|
|
<result column="roomName" property="roomName"/>
|
|
<result column="roomNum" property="roomNum"/>
|
|
<result column="idcard" property="idcard"/>
|
|
<result column="template" property="template"/>
|
|
<result column="examId" property="examId"/>
|
|
<result column="userId" property="user.id"/>
|
|
<result column="userName" property="user.name"/>
|
|
<result column="picture" property="picture"/>
|
|
<result column="template" property="template"/>
|
|
<result column="isActive" property="isActive"/>
|
|
<result column="dateNow" property="dateNow"/>
|
|
<result column="nowIdcard" property="nowIdcard"/>
|
|
<result column="nowUserName" property="nowUserName"/>
|
|
</resultMap>
|
|
<sql id="baseSQL">
|
|
select
|
|
sr.department,
|
|
sr.authIdentity,
|
|
sr.lat_x as latitude,
|
|
sr.lon_y as longitude,
|
|
room.room_id as roomId,
|
|
room.room_name as roomName,
|
|
sr.id as seatId,
|
|
sr.name as name,
|
|
sr.idcard as idcard,
|
|
sr.room_session as roomSession,
|
|
sr.if_violations as ifViolations,
|
|
sr.seat as seat,
|
|
sr.picture,
|
|
sr.specialty as specialty,
|
|
if(poo.id=226, CONCAT(poo.`NAME`,'/',po.`NAME`), CONCAT(pooo.`NAME`,'/',poo.`NAME`,'/',po.`NAME`)) as specialtyName
|
|
FROM
|
|
sz_seat 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 exam_room room on room.room_id =sr.room_id
|
|
</sql>
|
|
<select id="findByPage" resultType="com.bonus.seat.beans.SeatBean" parameterType="com.bonus.seat.beans.SeatBean">
|
|
<include refid="baseSQL"/>
|
|
where
|
|
1=1
|
|
</select>
|
|
<select id="findById" resultType="com.bonus.seat.beans.SeatBean" parameterType="com.bonus.seat.beans.SeatBean">
|
|
select picture from screen_people where
|
|
id=#{seatId}
|
|
</select>
|
|
<select id="findCount" resultType="int">
|
|
SELECT COUNT(*) from logon_limit where logon_count='1'
|
|
</select>
|
|
|
|
|
|
<delete id="delete" parameterType="com.bonus.seat.beans.SeatBean">
|
|
delete from sz_seat where exam_id = #{examId}
|
|
</delete>
|
|
<delete id="deleteApply" parameterType="com.bonus.seat.beans.SeatBean">
|
|
delete from sz_seat where id = #{seatId}
|
|
</delete>
|
|
|
|
<update id="updateIsActive" parameterType="com.bonus.score.beans.ScoreBean">
|
|
update
|
|
sz_seat
|
|
set
|
|
is_active = 0
|
|
where
|
|
idcard = #{userId}
|
|
and
|
|
exam_id = #{examId}
|
|
</update>
|
|
<update id="deletebyTime" parameterType="String">
|
|
update
|
|
logon_limit
|
|
set
|
|
logon_count = 2
|
|
where
|
|
logon_time = #{0}
|
|
|
|
</update>
|
|
<update id="updateBykc" parameterType="com.bonus.seat.beans.SeatBean">
|
|
update
|
|
sz_seat
|
|
set picture=#{picture},if_violations=1
|
|
where seat=#{seatId} and room_id=#{roomName}
|
|
</update>
|
|
<update id="insertNowIdcard" parameterType="com.bonus.seat.beans.SeatBean">
|
|
update sz_seat
|
|
set
|
|
now_idcard = #{nowIdcard}
|
|
where
|
|
id = #{seatId}
|
|
</update>
|
|
|
|
<select id="findPersonBySeat" parameterType="com.bonus.seat.beans.SeatBean" resultMap="baseMap">
|
|
SELECT
|
|
ss.id as seatId,
|
|
ss.idcard AS idcard,
|
|
ss.exam_id as examId,
|
|
ss.seat AS seatNum,
|
|
ss.room_id AS roomId
|
|
FROM
|
|
sz_seat ss
|
|
WHERE
|
|
ss.seat = #{seatNum}
|
|
|
|
AND ss.room_id = #{roomId}
|
|
|
|
AND ss.is_active = 1
|
|
</select>
|
|
|
|
<select id="findSeatByIp" parameterType="java.lang.String" resultMap="baseMap">
|
|
SELECT
|
|
es.seat_id as seatId,
|
|
es.seat_num AS seatNum,
|
|
es.room_id AS roomId
|
|
FROM
|
|
exam_seat es
|
|
WHERE
|
|
es.seat_ip = #{ipAddress}
|
|
</select>
|
|
|
|
<select id="checkSeat" parameterType="com.bonus.seat.beans.SeatBean" resultMap="baseMap">
|
|
SELECT
|
|
es.seat_id AS seatId,
|
|
es.seat_num AS seatNum,
|
|
es.seat_ip AS seatIp,
|
|
er.room_id AS roomId,
|
|
er.room_num AS roomNum,
|
|
er.room_name AS roomName,
|
|
sr.idcard AS idcard,
|
|
sr.`name` AS userName,
|
|
ss.picture AS picture,
|
|
ss.template AS template,
|
|
ss.exam_id AS examId,
|
|
ss.is_active AS isActive,
|
|
ss.date_now AS dateNow,
|
|
pu.LOGIN_NAME AS nowIdcard,
|
|
pu.`name` AS nowUserName
|
|
FROM
|
|
exam_seat es
|
|
LEFT JOIN sz_seat AS ss ON ss.seat = es.seat_num
|
|
LEFT JOIN exam_room AS er ON er.room_id = ss.room_id
|
|
LEFT JOIN sz_registration AS sr ON sr.idcard = ss.idcard
|
|
LEFT JOIN pm_user AS pu ON pu.LOGIN_NAME = ss.now_idcard
|
|
WHERE
|
|
es.room_id = ss.room_id
|
|
AND ss.exam_id = #{examId}
|
|
</select>
|
|
<insert id="insertlogo" parameterType="com.bonus.seat.beans.SeatBean">
|
|
insert into logon_limit(
|
|
<if test="name != null" >
|
|
logon_name,
|
|
</if>
|
|
<if test="state != null" >
|
|
logon_count,
|
|
</if>
|
|
<if test="seatId != null" >
|
|
logon_ip,
|
|
</if>
|
|
<if test="createTime != null" >
|
|
logon_time
|
|
</if>
|
|
)values (
|
|
<if test="name != null" >
|
|
#{name},
|
|
</if>
|
|
<if test="state != null" >
|
|
#{state},
|
|
</if>
|
|
<if test="seatId != null" >
|
|
#{seatId},
|
|
</if>
|
|
<if test="createTime != null" >
|
|
#{createTime}
|
|
</if>
|
|
)
|
|
</insert>
|
|
<insert id="insertInfo" parameterType="com.bonus.seat.beans.SeatBean" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sz_seat(
|
|
|
|
<if test="idcard != null" >
|
|
idcard,
|
|
</if>
|
|
<if test="name != null" >
|
|
name,
|
|
</if>
|
|
<if test="seatNum != null" >
|
|
seat,
|
|
</if>
|
|
<if test="examId != null" >
|
|
exam_id,
|
|
</if>
|
|
<if test="roomId != null" >
|
|
room_id,
|
|
</if>
|
|
<if test="nowIdcard != null" >
|
|
now_idcard,
|
|
</if>
|
|
create_time,
|
|
|
|
<if test="roomSession != null" >
|
|
room_session,
|
|
</if>
|
|
<if test="specialty != null" >
|
|
specialty,
|
|
</if>
|
|
<if test="department != null" >
|
|
department,
|
|
</if>
|
|
<if test="authIdentity != null" >
|
|
authIdentity,
|
|
</if>
|
|
if_violations
|
|
|
|
)values (
|
|
<if test="idcard != null" >
|
|
#{idcard},
|
|
</if>
|
|
<if test="name != null" >
|
|
#{name},
|
|
</if>
|
|
<if test="seatNum != null" >
|
|
#{seatNum},
|
|
</if>
|
|
<if test="examId != null" >
|
|
#{examId},
|
|
</if>
|
|
<if test="roomId != null" >
|
|
#{roomId},
|
|
</if>
|
|
<if test="nowIdcard != null" >
|
|
#{idcard},
|
|
</if>
|
|
sysdate(),
|
|
|
|
<if test="roomSession != null" >
|
|
#{roomSession},
|
|
</if>
|
|
<if test="specialty != null" >
|
|
#{specialty},
|
|
</if>
|
|
<if test="department != null" >
|
|
#{department},
|
|
</if>
|
|
<if test="authIdentity != null" >
|
|
#{authIdentity},
|
|
</if>
|
|
0
|
|
)
|
|
</insert>
|
|
|
|
<select id="finRoomInfo" resultMap="baseMap">
|
|
select
|
|
room_id as roomId,
|
|
room_name as roomName,
|
|
room_num as roomNum
|
|
from
|
|
exam_room
|
|
</select>
|
|
|
|
|
|
</mapper> |