studentmapper.xml
2.24 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
<?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.StudentDao">
<!--声明返回结果参数-->
<resultMap id="BaseResultMap" type="com.sincere.morningcheck.model.Student">
<result column="student_id" property="stuId" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<result column="name" property="stuName" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="class_id" property="classId" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<result column="class_name" property="className" jdbcType="VARCHAR" javaType="java.lang.String"/>
<result column="Cards" property="cardNos" jdbcType="VARCHAR" javaType="java.lang.String"/>
</resultMap>
<select id="getStudents" resultMap="BaseResultMap">
select class_id,student_id,name,class_name,(student_num+
case when
(select dbo.StringJoin(distinct a.CardNum) from HS_StudentCards a where a.State=1 and a.CardNum is not null and len(a.CardNum)=8 and a.StudentId=vs.student_id)!=''
then
','+(select dbo.StringJoin( a.CardNum) from HS_StudentCards a where a.State=1 and a.CardNum is not null and len(a.CardNum)=8 and a.StudentId=vs.student_id)
else
''
end
) as Cards
from SZ_V_School_Student vs where vs.role_state=1 and vs.school_id=#{schoolId} and vs.student_num is not null and LEN(vs.student_num)=8
</select>
<select id="getStudentByCardNo" resultMap="BaseResultMap">
select top 1 vs.name,vs.student_id,vs.class_id,vs.class_name from SZ_V_School_Student vs
inner join SZ_V_Card b on b.type=2 and vs.student_id=b.user_id and b.num=#{cardNo}
where vs.role_state=1
</select>
<select id="swipeCard" statementType="CALLABLE" resultType="java.util.Map">
{call xiaoan.dbo.AttendanceService(
#{att_id, mode=IN},
#{card_num, mode=IN},
#{func_no, mode=IN},
#{flag, mode=IN},
#{intime, mode=IN},
#{arr, mode=OUT, jdbcType=VARCHAR},
#{iscuccess,mode=OUT,jdbcType=INTEGER}
)}
</select>
</mapper>