usermapper.xml
5.44 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?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.example.dahua.dao.UserDao">
<!--<select id="getStudentNum" resultType="String" parameterType="String">-->
<!--select student_num-->
<!--from SZ_V_School_Student-->
<!--where school_id = #{school_id}-->
<!--and studentcode = #{studentcode}-->
<!--</select>-->
<select id="getStudentList" resultType="com.example.dahua.bean.StudentBean">
select * from SZ_V_School_Student where school_id = #{schoolId}
<if test="studentType != null">
and student_type = #{studentType}
</if>
<if test="sex != null and sex.size() >0">
and sex in
<foreach item="item" collection="sex" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
and (student_num is not null or student_num != '') and (photo is not null or photo !='') order by newid()
</select>
<select id="getTeacherList" resultType="com.example.dahua.bean.StudentBean">
select * from SZ_V_School_Teacher where school_id = #{schoolId}
and (teacher_num is not null or teacher_num !='')
and (face is not null or face !='')
</select>
<select id="getAuthRecord" resultType="com.example.dahua.bean.DeviceAuthRecord">
select * from AC_DeviceAuthRecord where State = 1 and GrantState = 1 and SchoolId = #{schoolId}
<if test="studentType != null">
and StudentType = #{studentType}
</if>
</select>
<select id="queryClintList" resultType="com.example.dahua.bean.AttendanceBean">
select * from SZ_Attendance where school_id = #{schoolId} and clint_type in(22,29)
<if test="deviceId != null and deviceId.trim() !=''">
and clint_id = #{deviceId}
</if>
</select>
<select id="queryStudentIdList" resultType="java.lang.String">
select StudentId from SS_RoomNumber where Status=1 and SchoolId=#{schoolId}
and Pid in (select id from SS_Room where Status=1 and SchoolId=#{schoolId} and Pid=#{roomId})
and StudentId in (select student_id from SZ_V_School_Student where school_id= #{schoolId}) order by newid()
</select>
<select id="getRoomBySchoolId" resultType="java.lang.Integer">
select Id from ss_room where schoolId = #{schoolId} and pId = #{groupId}
</select>
<select id="getStudentByRoomIds" resultType="com.example.dahua.bean.StudentBean">
SELECT
ssu.*
from SS_RoomNumber ssr
LEFT JOIN SZ_V_School_Student ssu ON ssr.studentId = ssu.student_id
<where>
<if test="schoolId != null">
and ssr.schoolId = #{schoolId}
</if>
<if test="pIdList != null and pIdList.size()>0">
and ssr.Pid in
<foreach item="item" collection="pIdList" open="(" separator="," close=")" index="">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getStudentByClassId" resultType="com.example.dahua.bean.StudentBean">
select * from SZ_V_School_Student where school_id = #{schoolId}
<if test="studentType != null">
and student_type = #{studentType}
</if>
<if test="sexList != null and sexList.size() >0">
and sex in
<foreach item="item" collection="sexList" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="classIds != null and classIds.size() >0">
and class_id in
<foreach item="item" collection="classIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
and student_num != '' and photo !=''
</select>
<select id="getStudentByKeyword" resultType="com.example.dahua.bean.StudentBean">
select * from SZ_V_School_Student where school_id = #{schoolId}
<if test="keyword != null and keyword !=''">
and class_name like concat('%', #{keyword}, '%')
</if>
and student_num != '' and photo !=''
</select>
<select id="getGroupByClassId" resultType="java.lang.Integer">
SELECT
Pid
FROM
SZ_OneCardGrouping
WHERE
ClassId = #{classId}
AND state = 1
</select>
<resultMap id="YxStudentMap" type="com.example.dahua.bean.yx.ImportStudent">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" property="name"/>
<result column="user_id" property="userId"/>
<result column="card_num" property="cardNum"/>
<result column="photo" property="photo"/>
<result column="school_Id" property="schoolId"/>
<result column="student_code" property="studentCode"/>
<result column="scene_name" property="sceneName"/>
</resultMap>
<insert id="insertStudent" parameterType="com.example.dahua.bean.yx.ImportStudent">
insert into sz_student_yx values (#{name},#{userId},#{cardNum},#{photo},#{studentCode},#{schoolId},#{sceneName})
</insert>
<select id="selectStudentList" resultMap="YxStudentMap">
select * from sz_student_bak
</select>
<select id="selectYxStudentList" resultMap="YxStudentMap">
select * from sz_student_yx where school_id =#{schoolId} and scene_name = #{sceneName}
</select>
</mapper>