StudentCheckReport.xml
5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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.sincere.morningcheck.dao.StudentCheckReportDao">
<!--声明返回结果参数-->
<resultMap id="BaseResultMap" type="com.sincere.morningcheck.model.StudentCheckReport">
<!-- id:指定查询列中的唯 一标识,即主键,可配置多个-->
<id column="id" property="id" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<result column="student_id" property="student_id" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<result column="cardNo" property="cardNo" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="checkResult" property="checkResult" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="robotResult" property="robotResult" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="String" property="String" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="intime" property="inTime" jdbcType="DATE" javaType="java.util.Date"/>
<result column="checkTime" property="checkTime" jdbcType="TIMESTAMP" javaType="java.util.Date"/>
<result column="temperature" property="temperature" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="handImgId" property="handImgId" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="mouthImgId" property="mouthImgId" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="eyeImgId" property="eyeImgId" jdbcType="VARCHAR" javaType="java.lang.String"/>
</resultMap>
<sql id="Base_Column_List">
id,student_id,cardNo,checkTime,checkResult,robotResult,intime,access,temperature,handImgId,mouthImgId,eyeImgId
</sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.sincere.morningcheck.model.StudentCheckReport" >
insert xiaoan.dbo.SZ_StudentCheckReport(student_id,cardNo,checkResult,robotResult,intime,checkTime,access,temperature,handImgId,mouthImgId,eyeImgId)
values(#{student_id,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{robotResult,jdbcType=VARCHAR},#{inTime,jdbcType=TIMESTAMP},#{checkTime,jdbcType=TIMESTAMP},#{access,jdbcType=VARCHAR},#{temperature,jdbcType=VARCHAR},#{handImgId,jdbcType=VARCHAR},#{mouthImgId,jdbcType=VARCHAR},#{eyeImgId,jdbcType=VARCHAR})
</insert>
<insert id="insertCheckHis" parameterType="com.sincere.morningcheck.model.StudentCheckReportHis" >
insert xiaoan.dbo.SZ_StudentCheckReportHistory(check_id,student_id,cardNo,checkResult,robotResult,intime,checkTime,access,temperature,handImgId,mouthImgId,eyeImgId)
values(#{check_id,jdbcType=INTEGER},#{student_id,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR}, #{checkResult,jdbcType=VARCHAR}, #{robotResult,jdbcType=VARCHAR},#{inTime,jdbcType=TIMESTAMP},#{checkTime,jdbcType=TIMESTAMP},#{access,jdbcType=VARCHAR},#{temperature,jdbcType=VARCHAR},#{handImgId,jdbcType=VARCHAR},#{mouthImgId,jdbcType=VARCHAR},#{eyeImgId,jdbcType=VARCHAR})
</insert>
<update id="updateByStudent" parameterType="com.sincere.morningcheck.model.StudentCheckReport" >
update xiaoan.dbo.SZ_StudentCheckReport
<set>checkResult=#{checkResult,jdbcType=VARCHAR},robotResult=#{robotResult,jdbcType=VARCHAR},intime=#{inTime,jdbcType=TIMESTAMP},checkTime=#{checkTime,jdbcType=TIMESTAMP},access=#{access,jdbcType=VARCHAR},temperature=#{temperature,jdbcType=VARCHAR},handImgId=#{handImgId,jdbcType=VARCHAR},mouthImgId=#{mouthImgId,jdbcType=VARCHAR},eyeImgId=#{eyeImgId,jdbcType=VARCHAR}
</set>
where id=#{id,jdbcType=INTEGER}
</update>
<select id="getCheckReport" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from xiaoan.[dbo].[SZ_StudentCheckReport]
where student_id = #{studentId} and CONVERT(varchar(10),checkTime,23) = CONVERT(varchar(10),getdate(),23)
</select>
<select id="getCheckReportBySchoolId" resultMap="BaseResultMap">
select sc.student_id,cardNo,checkTime,checkResult,robotResult,intime,access,temperature,handImgId,mouthImgId,eyeImgId from SZ_V_School_Student vs join xiaoan.[dbo].[SZ_StudentCheckReport] sc
on vs.student_id=sc.student_id where school_id=#{schoolId}
and CONVERT(varchar,checkTime,23)=#{checkTime}
</select>
<select id="getCheckStuCountBySchoolId" resultType="java.lang.Integer">
select count(0) from SZ_V_School_Student vs join xiaoan.[dbo].[SZ_StudentCheckReport] sc on vs.student_id=sc.student_id where school_id=#{schoolId} and CONVERT(varchar,checkTime,23)=#{checkTime}
</select>
<select id="getCheckExReportByGrade" resultType="com.sincere.morningcheck.model.ClassExReport">
select a.class_id,name=a.class_name,count = count(a.class_id) from SZ_V_School_Student a join SZ_Class b on a.class_id=b.class_id
join xiaoan.[dbo].[SZ_StudentCheckReport] c on a.student_id = c.student_id
where a.school_id=#{schoolId} and state=1 and grade=#{gradeId} and CHARINDEX('N',checkResult)>0 and CONVERT(varchar,checkTime,23)=#{checkTime}
group by a.class_id,a.class_name
</select>
</mapper>