<?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">
|
<!--
|
namespace:必须与对应的接口全类名一致
|
id:必须与对应接口的某个对应的方法名一致
|
|
-->
|
<mapper namespace="com.basic.x01.location.mapper.LocationMapper">
|
<resultMap id="TbLocDevice" type="TbLocDevice">
|
<id property="schoolId" column="school_id" />
|
<id property="deviceRn" column="device_rn" />
|
<result property="transferId" column="transfer_id" />
|
<result property="deviceIp" column="device_ip" />
|
<result property="deviceName" column="device_name" />
|
</resultMap>
|
|
<resultMap id="TbLocPosition" type="TbLocPosition">
|
<id property="schoolId" column="school_id" />
|
<id property="positionId" column="position_id" />
|
<result property="positionName" column="position_name" />
|
<result property="outConfig" column="out_config" />
|
<result property="inConfig" column="in_config" />
|
<result property="gatePosition" column="gate_position" />
|
</resultMap>
|
|
<resultMap id="TbSchoolStudent" type="TbSchoolStudent">
|
<id property="studentId" column="student_id" />
|
<result property="schoolId" column="school_id" />
|
<result property="classId" column="class_id" />
|
<result property="studentName" column="student_name" />
|
<result property="age" column="age" />
|
<result property="gender" column="gender" />
|
<result property="locCardNo" column="loc_card_no" />
|
<result property="status" column="status" />
|
</resultMap>
|
|
<resultMap id="TbSchoolClass" type="TbSchoolClass">
|
<id property="classId" column="class_id" />
|
<result property="schoolId" column="school_id" />
|
<result property="gradeName" column="grade_name" />
|
<result property="className" column="class_name" />
|
</resultMap>
|
|
<resultMap id="TbLocTransfer" type="TbLocTransfer">
|
<id property="transferId" column="transfer_id" />
|
<id property="schoolId" column="school_id" />
|
<result property="transferName" column="transfer_name" />
|
<result property="relayConfig" column="relay_config" />
|
</resultMap>
|
|
<resultMap id="Form_sign" type="Form_sign">
|
<id property="sign_time" column="sign_time" />
|
<id property="sign_card_id" column="sign_card_id" />
|
<result property="sign_type" column="sign_type" />
|
<result property="location_id" column="location_id" />
|
</resultMap>
|
|
<select id="getSchoolTransferDevice" resultMap="TbLocTransfer">
|
select * from tb_loc_transfer
|
where school_id=#{0} and transfer_id=#{1}
|
limit 1
|
</select>
|
<select id="getValidCardNoList" resultType="java.lang.String">
|
select loc_card_no from tb_school_student
|
where school_id=#{0} and status='1'
|
and loc_card_no is not null
|
and loc_card_no !=''
|
</select>
|
<select id="getLocLogList" resultType="java.util.HashMap">
|
select grade_name, class_name, student_name, loc_card_no, loc_time
|
, (case loc_type when 0 then position_name
|
when 1 then concat('(进入)',position_name)
|
when 2 then concat('(离开)',position_name)
|
when 3 then concat(position_name, '(门内)')
|
when 4 then concat(position_name, '(门外)')
|
end) as position_name
|
from tb_loc_log l
|
where exists (select 1 from tb_school_student s
|
where s.student_id=l.student_id
|
and s.school_id=#{schoolId}
|
and instr(loc_time, #{searchDate})>0
|
<if test="searchName!=null and searchName!=''">
|
and (student_name like #{searchName}
|
or loc_card_no like #{searchName}
|
)
|
</if>
|
)
|
order by loc_time desc
|
</select>
|
|
|
|
<insert id="insertForm_sign">
|
INSERT INTO form_sign(
|
id,
|
create_by,
|
create_date,
|
update_by,
|
update_date,
|
remarks,
|
del_flag,
|
sign_card_id,
|
sign_time,
|
sign_type,
|
location_id
|
) VALUES (
|
#{id},
|
#{create_by},
|
#{create_date},
|
#{update_by},
|
#{update_date},
|
#{remarks},
|
#{del_flag},
|
#{sign_card_id},
|
#{sign_time},
|
#{sign_type},
|
#{location_id}
|
)
|
|
</insert>
|
|
<insert id="insertTbLocLog">
|
insert into tb_loc_log (
|
student_id, student_name,
|
grade_name, class_name,
|
loc_card_no, position_id,
|
position_name, gate_position,
|
loc_time, loc_type
|
) values (
|
#{stu.studentId}, #{stu.studentName},
|
#{cls.gradeName}, #{cls.className},
|
#{stu.locCardNo}, #{pos.positionId},
|
#{pos.positionName}, #{pos.gatePosition},
|
#{locTime}, #{locType}
|
)
|
|
</insert>
|
|
<select id="getSchoolClassBySchoolIdClassId" resultMap="TbSchoolClass">
|
select * from tb_school_class
|
where school_id=#{0}
|
and class_id=#{1}
|
limit 1
|
</select>
|
|
<select id="getLocPositionBySchoolIdPositionId" resultMap="TbLocPosition">
|
select * from tb_loc_position
|
where school_id=#{0}
|
and position_id=#{1}
|
limit 1
|
</select>
|
|
<select id="getStudentBySchoolIdLocCardNo" resultMap="TbSchoolStudent">
|
select * from tb_school_student
|
where school_id=#{0}
|
and loc_card_no=#{1}
|
limit 1
|
</select>
|
|
<select id="checkSchoolAccessKey" resultType="int">
|
select count(0)
|
from tb_loc_school
|
where school_id=#{0} and access_key=#{1}
|
</select>
|
|
<select id="getLocDeviceListBySchoolIdTransferId" resultMap="TbLocDevice">
|
select * from tb_loc_device
|
where school_id=#{0} and transfer_id=#{1}
|
order by device_rn
|
</select>
|
|
<select id="getLocPositionListBySchoolId" resultMap="TbLocPosition">
|
select * from tb_loc_position
|
where school_id=#{0}
|
order by position_id
|
</select>
|
</mapper>
|