studentmapper.xml
3.87 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
68
69
70
71
72
73
74
75
76
77
78
79
<?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="getStudentByStudentId" resultMap="BaseResultMap">
select top 1 vs.name,vs.student_id,vs.class_id,vs.class_name from SZ_V_School_Student vs
where role_state=1 and school_id=#{schoolId} and student_id=#{studentId}
</select>
<select id="getStudentByStuUserId" resultMap="BaseResultMap">
select top 1 vs.name,vs.student_id,vs.class_id,vs.class_name,Cards=vs.student_num from SZ_V_School_Student vs
where user_id=#{sUserId}
</select>
<select id="getStuCountBySchoolId" resultType="java.lang.Integer">
select count(0) from SZ_V_School_Student where school_id=#{schoolId}
</select>
<select id="getGradeBySchoolId" resultType="com.sincere.morningcheck.model.Grade">
select id,grade,ShortName from SZ_Grade where Status=1 and SchoolId = #{schoolId}
</select>
<select id="getStuUserId" resultType="java.lang.String">
select vs.user_id 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=#{num}
where vs.role_state=1 and school_id = #{schoolId}
</select>
<select id="getOpenId" resultType="java.lang.String">
select u.XSTOpenId from SZ_UserRole ur join
SZ_SPRole sp on ur.customerId = sp.student_id join
SZ_userrole ur2 on sp.parent_id = ur2.customerId
join sz_user u on ur2.user_id = u.user_id
where ur.user_id = #{stuUserId}
and ur2.usertype = 3 and ur2.school_id = #{schoolId}
and (u.XSTOpenId !='' or u.XSTOpenId is not null)
</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>