UserDao.java
16.2 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
package com.example.dahua.dao;
import com.example.dahua.bean.*;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
@Mapper
public interface UserDao {
@Select(" select student_num from SZ_V_School_Student where school_id = #{school_id} and studentcode = #{studentcode}")
public String getStudentNum(@Param("school_id") String school_id, @Param("studentcode") String studentcode);
@Select("select school_id from SZ_Attendance where clint_id = #{clint_id} ")
String getSchoolIdbyClint_id( @Param("clint_id") String clint_id);
@Select("select * from SZ_Attendance where school_id = #{schoolId} and clint_type = 29")
List<String> selectDeviceBySchoolId(@Param("schoolId") Integer schoolId);
/**
* 获取设备出入类型
* @param clint_id
* @return
*/
@Select("select * from SZ_Attendance where clint_id = #{clint_id} ")
AttendanceBean getTypeByClint_id( @Param("clint_id") String clint_id);
@Select("select * from SZ_Attendance where school_id = #{school_id} and clint_type = #{clint_type}")
List<AttendanceBean> getAttendanceBeans(@Param("school_id") String school_id, @Param("clint_type") String clint_type);
@Select("select * from SZ_Attendance where school_id = #{school_id} and clint_type = #{clint_type} and clint_id = #{clint_id}")
List<AttendanceBean> getAttendanceBeanWithId(@Param("school_id") String school_id, @Param("clint_type") String clint_type, @Param("clint_id") String clint_id);
@Select(" select Top(1)* from SZ_V_School_Student where school_id = #{school_id} and studentcode = #{studentcode}")
UserInfoBean getUserInfo(@Param("school_id") String school_id, @Param("studentcode") String studentcode);
@Select("select * from SZ_V_School_Student where school_id = 1066 and class_id between 78506 and 78514")
List<UserInfoBean> getStuUserInfos();
@Select(" select Top(1)* from SZ_V_School_Teacher where school_id = #{school_id} and num = #{num}")
TeacherBean getTeacher(@Param("school_id") String school_id, @Param("num") String num);
@Select(" select Top(1)* from SZ_V_School_Teacher where teacher_id = #{teacher_id}")
TeacherBean getTeacherWithId(@Param("teacher_id") String teacher_id);
@Select(" select * from SZ_V_School_Teacher where school_id = 562 and name = #{name}")
List<TeacherBean> getTeachersWithName(@Param("name") String name);
/**
* 记录用户和设备集编号对应关系
*
* @param user_id
* @return
*/
@Select("select top 1 recordNo from SZ_Student_RecoderNo where user_id = #{user_id} and deviceId = #{deviceId}")
String getRecordNo(@Param("user_id") String user_id, @Param("deviceId") String deviceId);
/**
* 获取学生考勤类型
* @param school_id
* @param customerid
* @return
*/
@Select(" select Top(1) student_type from SZ_V_School_Student where school_id = #{school_id} and student_id = #{customerid}")
String getStudentType(@Param("school_id") String school_id, @Param("customerid") String customerid);
@Insert("insert into SZ_Student_RecoderNo values(#{user_id},#{recordNo},#{student_name},#{deviceId})")
int saveRecordNo(@Param("user_id") String user_id, @Param("recordNo") int recordNo, @Param("student_name") String student_name, @Param("deviceId") String deviceId);
@Select("select CardNum from HS_StudentCards where StudentId = #{StudentId} and CardType = #{CardType}")
String getCardNum(@Param("StudentId") String StudentId, @Param("CardType") String CardType);
@Delete("delete from SZ_Student_RecoderNo where user_id = #{user_id} and recordNo = #{recordNo}")
void deleteRecordNo(@Param("user_id") String user_id, @Param("recordNo") int recordNo);
@Update("update SZ_Student_RecoderNo set user_id = #{user_id} where deviceId = #{deviceId} and recordNo = #{recordNo}")
void updateRecordNo(@Param("user_id") String user_id, @Param("recordNo") int recordNo, @Param("deviceId") String deviceId);
@Select("select clint_id from SZ_Attendance where clint_type = #{clint_type} and school_id = #{school_id}")
List<String> getDeviceIds(@Param("clint_type") String clint_type, @Param("school_id") int school_id);
@Select("select Top(1) * from HS_StudentUpdateCard where CustomerId = #{CustomerId} order by AddTime desc")
StudentBean getStudentUpdate(@Param("CustomerId") String customerid);
@Select("select school_name from SZ_School where school_id = #{school_id}")
String getSchoolName(@Param("school_id") String school_id);
@Select(" select studentcode from SZ_V_School_Student where student_id = #{customerid}")
String getStudentCode(@Param("customerid") String customerid);
@Select(" select top 1* from SZ_V_School_Student where student_id = #{student_id}")
UserInfoBean getStudentWithid(@Param("student_id") String student_id);
@Select(" select top 1* from SZ_V_School_Student where user_id = #{userId}")
UserInfoBean getStudentByUserId(@Param("userId") String userId);
@Select(" select * from SZ_V_School_Student where student_num = #{student_num} and name = #{name}")
UserInfoBean getStudent(@Param("student_num") String student_num, @Param("name") String name);
@Select(" select * from SZ_V_School_Student where school_id = #{school_id} and sex = #{sex} and student_type = #{student_type}")
List<UserInfoBean> getStudentWithSchoolId(@Param("school_id") String school_id, @Param("sex") String sex, @Param("student_type") String student_type);
@Select(" select * from SZ_V_School_Student where school_id = #{school_id}")
List<UserInfoBean> getStudentBySchoolId(@Param("school_id") Integer school_id);
@Select("select * from SZ_V_School_Student where school_id = 479 and student_type = 2")
List<UserInfoBean> getUsers();
@Select("select * from SZ_V_School_Student where school_id = 479 and student_type = 2 and student_id in(select StudentId from ss_roomnumber " +
"where SchoolId = 479 and Pid in(select id from SS_Room where SchoolId = 479 and pid =10287))")
List<UserInfoBean> getUserInfos();
@Select("select clint_id from SZ_Attendance where school_id = #{school_id} and clint_type = 4 ")
List<String> getAllDecWithSch(@Param("school_id") int school_id);
@Select("select * from SZ_Attendance where clint_type = #{clint_type} and school_id = #{school_id}")
List<AttendanceBean> selectDeviceWithschool_id(@Param("clint_type") String clint_type, @Param("school_id") String school_id);
@Select("select * from SZ_Attendance where school_id = #{school_id}")
List<AttendanceBean> getAllDevices(@Param("school_id") String school_id);
@Select("select * from SZ_V_School_Student where school_id = #{school_id} and len(photo)>0 and len(student_num)>0")
List<StudentBean> getAllStudentsWithSchoolId(@Param("school_id") String school_id);
@Select("select Top(1) user_id from SZ_V_School_Student where student_num = #{student_num}")
String getUerIdWithNum(@Param("student_num") String student_num);
@Select("select StudentId from SS_RoomNumber where Pid in (select id from SS_Room where SchoolId = 479)")
List<String> getStudentIds();
@Select("select Top(1) * from SZ_V_Card where num=#{num}")
CardBean getCards(@Param("num") String num);
@Select("select clint_id from SZ_Attendance where school_id = #{schoolId} and (clint_type = 8 or clint_type = 9 or clint_type = 10)")
List<String> getClintIds(@Param("schoolId") String schoolId);
@Select("select Top(1) school_id from SZ_V_School_Student where student_num = #{cardNum}")
String getSchoolIdWidthCardNum(@Param("cardNum") String cardNum);
@Select("select Top(1) PlaceId from XA_PlaceAttendance where KaoQinAttendance = #{qiandaoDevId}")
String getPlaceIdWithKaoqinDevid(@Param("qiandaoDevId") String qiandaoDevId);
@Select("select Top(1) PlaceId from XA_PlaceAttendance where KanBanAttendance = #{kanBanDevId}")
String getPlaceIdWithKanBanDevid(@Param("kanBanDevId") String kanBanDevId);
@Select("select KanBanAttendance from XA_PlaceAttendance where PlaceId = #{PlaceId} and (len(KanBanAttendance)>0 and KanBanAttendance is not null)")
List<String> getKanBanIdWithPlaceId(@Param("PlaceId") String placeId);
@Select("select user_id,studentcode from SZ_V_School_Student where school_id = 27")
List<StudentBean> getStudentUserIdsWith();
@Select(" select * from SZ_V_School_Teacher where school_id = #{school_id}")
List<TeacherBean> getTeachers(@Param("school_id") String school_id);
@Select("select * from SZ_User where user_id =#{userId} and state = 1")
void getUserWidthUserId(@Param("userId") String userId);
@Select("select * from SZ_V_School_Student where user_id = #{userId}")
List<StudentBean> getStudentWithUserId(@Param("userId") String userId);
@Select("select * from SZ_V_School_Teacher where user_id = #{userId}")
List<TeacherBean> getTeaWithUserId(@Param("userId") String userId);
@Select("select Top(1) user_id from SZ_V_School_Student where studentcode = #{studentcode}")
String getStuWithCode(@Param("studentcode") String code);
@Select("select top(1) num from SZ_V_School_Teacher where teacher_num=#{num}")
String getTeaNumWithCard(@Param("num") String num);
@Select("select clint_type from SZ_Attendance where clint_id = #{clint_id}")
String getClintType(@Param("clint_id") String deviceID);
@Select("select v.* from SZ_Student as s inner join SZ_V_School_Student as v on s.student_id = v.student_id where s.intime>'2020-09-01' and school_id = 654 order by student_id desc ")
List<StudentBean> getStus();
@Insert("insert into HS_StudentUpdateCard(UserId,CustomerId,StudentType,UserType,Name,ClassId,ClassName,Card,SchoolId,IsNew,UpdateType,AddTime,Sex,StudentCode,mobile) values (" +
"#{UserId},#{CustomerId},#{StudentType},#{UserType},#{Name},#{ClassId},#{ClassName},#{Card},#{SchoolId},#{IsNew},#{UpdateType},#{AddTime},#{Sex},#{StudentCode},#{mobile})")
void insertUpdateCard(@Param("UserId")String UserId,@Param("CustomerId")String CustomerId,@Param("StudentType")String StudentType,@Param("UserType")String UserType,
@Param("Name")String Name,@Param("ClassId")String ClassId,@Param("ClassName")String ClassName,@Param("Card")String Card,@Param("SchoolId")String SchoolId,
@Param("IsNew")String IsNew,@Param("UpdateType")String UpdateType,@Param("AddTime")String AddTime,@Param("Sex")String Sex,@Param("StudentCode")String StudentCode,
@Param("mobile")String mobile);
@Select("select Top(1)* from SZ_V_School_Teacher where num = #{num} and school_id = #{schoolId}")
StudentBean getTeacherWithstudentcode(@Param("num") String num, @Param("schoolId") String schoolId);
@Select("select Top(1)* from SZ_V_School_Student where studentcode = #{studentcode} and school_id = #{schoolId}")
StudentBean getStudentWithstudentcode(@Param("studentcode") String studentcode, @Param("schoolId") String schoolId);
@Update("update SZ_User set face = #{httpUrl} where user_id =(\n" +
" select user_id\n" +
" from SZ_V_School_Student\n" +
" where studentcode = #{studentcode} and school_id = #{school_id}\n" +
")")
void updateStu(@Param("studentcode") String studentCode,@Param("httpUrl") String httpUrl,@Param("school_id")String school_id);
/**
* 获取学生信息
* @param cardNum
* @return
*/
@Select(" select school_id as schoolId , class_id as classId ,name ,student_id as studentId from\n" +
" (select top 1 b.school_id, b.class_id, b.name, student_id from SZ_V_Card a\n" +
" inner join SZ_V_School_Student b on a.user_id = b.student_id\n" +
" and b.role_state = 1 where a.type = 2 and a.num = #{cardNum}\n" +
" union\n" +
" select top 1 b.school_id, 0 as class_id, b.name,b.teacher_id as student_id from SZ_V_Card a\n" +
" inner join SZ_V_School_Teacher b on a.user_id = b.teacher_id\n" +
" and b.role_state = 1 where a.type = 0 and a.num = #{cardNum}\n" +
" ) x ")
List<User> selectUserByCardNum(@Param("cardNum") String cardNum);
/**
* 获取卡号
* @param cardNo
* @return
*/
@Select("select Top(1) StudentNum from HS_LeaveExaminePassList where StudentNum= #{cardNo} and GETDATE() > LeaveTime and GETDATE() < ReturnTime")
String checkLeave(@Param("cardNo") String cardNo);
/**
* 获取学生父母电话
* @param cardNo
* @return
*/
@Select("select school_id , ParentMobile , name from SZ_V_School_Student where student_num = #{cardNo}")
Message selectByParentMobile(@Param("cardNo") String cardNo);
/*************************************** 下发用户信息、人脸、卡、权限操作查询 add by xuquan ************************************/
@Select(" select Top(1)* from SZ_V_School_Student where school_id = #{school_id} and user_id = #{userId}")
UserInfoBean getUserInfoByUserId(@Param("school_id") String school_id,@Param("userId") String userId);
@Select(" select Top(1)* from SZ_V_School_Teacher where school_id = #{school_id} and user_id = #{userId}")
TeacherBean getTeacherByUserId(@Param("school_id") String school_id, @Param("userId") String userId);
/*************************************** 下发用户信息、人脸、卡、权限操作查询 add by xuquan ************************************/
/*************************************** 仅供测试,下发失败使用接口 start ************************************/
@Insert("insert into SZ_Student_RecoderNo values(#{user_id},#{recordNo},#{student_name},#{deviceId})")
int saveRecordNoTest(@Param("user_id") String user_id, @Param("recordNo") int recordNo, @Param("student_name") String student_name, @Param("deviceId") String deviceId);
@Delete("delete from SZ_Student_RecoderNo where user_id = #{user_id} and deviceId = #{deviceId}")
void deleteRecordNoTest(@Param("user_id") String user_id,@Param("deviceId") String deviceId);
@Select("select recordNo from SZ_Student_RecoderNo where student_name = #{student_name} and user_id = #{user_id} and deviceId =#{deviceId}")
List<String> getRecordNoTest(@Param("student_name") String name,@Param("user_id") String user_id,@Param("deviceId") String deviceId);
@Select("select Top(1) user_id from SZ_V_School_Student where student_num = #{student_num} and school_id = #{school_id}")
String getUerIdWithNumTest(@Param("student_num") String student_num,@Param("school_id") Integer schoolId);
@Select("select * from SZ_V_School_Student where school_id = #{school_id}")
List<UserInfoBean> getUserIdTest(@Param("school_id") String schoolId);
@Select("select clint_id from SZ_Attendance where school_id = #{school_id} and clint_type = 22 ")
List<String> getAttendanceTest(@Param("school_id") String schoolId);
/*************************************** 仅供测试,下发失败使用接口 end ************************************/
@Select("select Top(1)* from SZ_V_School_Student where student_num = #{card} and school_id = #{schoolId}")
StudentBean getStudentWithCard(@Param("card") String card,@Param("schoolId") Integer schoolId);
@Select("select Top(1)* from SZ_V_School_Teacher where teacher_num = #{teacher_num} and school_id = #{schoolId}")
StudentBean getTeacherWithCard(@Param("teacher_num") String teacher_num,@Param("schoolId") Integer schoolId);
List<StudentBean> getStudentList(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sex") List<Integer> sex);
List<StudentBean> getTeacherList(@Param("schoolId") Integer schoolId);
List<DeviceAuthRecord> getAuthRecord(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType);
List<AttendanceBean> queryClintList(@Param("schoolId") Integer schoolId,@Param("deviceId")String deviceId);
List<String> queryStudentIdList(@Param("schoolId") Integer schoolId,@Param("roomId")Integer roomId);
List<StudentBean> getStudentByClassId(@Param("schoolId") int schoolId,@Param("classIds") List<Integer> classIds);
List<Integer> getGroupByClassId(@Param("classId") Integer classId);
}