Blame view

cloud/haikangface/src/main/resources/mapper/usermapper.xml 9.38 KB
9962583e   陶汉栋   no message
1
2
3
4
5
<?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.haikangface.dao.UserDao">

    <!--<select id="getStudentNum" resultType="String" parameterType="String">-->
e92e5a92   陶汉栋   增加网关负载
6
7
8
9
    <!--select student_num-->
    <!--from SZ_V_School_Student-->
    <!--where school_id = #{school_id}-->
    <!--and studentcode = #{studentcode}-->
9962583e   陶汉栋   no message
10
11
    <!--</select>-->

acd712a6   陶汉栋   增加网关负载
12
13
14
15
16
17
18
19
20
    <select id="getStudentWiSidAndSex" resultType="java.lang.String">

        select student_num from SZ_V_School_Student where school_id = #{schoolId} and sex in
        <foreach collection="sexs" item="sex" index="index" open="(" separator="," close=")">
            #{sex}
        </foreach>

    </select>

b8a3cdaf   徐泉   智能校卫一阶段代码提交
21
22
23
24
25
26
27
28
    <select id="getStudentCard" resultType="java.lang.String">
        select distinct student_num from SZ_V_School_Student where school_id = #{schoolId} and student_type = #{studentType}
        and sex in
        <foreach item="item" collection="sex" separator="," open="(" close=")" index="">
            #{item}
        </foreach>
    </select>

acd712a6   陶汉栋   增加网关负载
29
    <select id="getDeviceRoomRelation" resultType="java.lang.String">
3009e2ac   陶汉栋   权限模板增加
30
        select clint_id from SZ_DeviceRoomRelation where clint_id = #{clint_id} and state = 1;
acd712a6   陶汉栋   增加网关负载
31
32
    </select>

191a8018   陶汉栋   无感考勤
33
34
35
36
37
    <insert id="insertBaiduFaceRecorder" parameterType="com.sincere.haikangface.bean.BaiduFaceRecorder">

        insert into BaiduFaceRecorder values (#{name},#{userId},#{score},#{time},#{uploadImgUrl},#{userImgUrl})

    </insert>
b8a3cdaf   徐泉   智能校卫一阶段代码提交
38
39
40
41
42
43
44
45
46
47
48
49

    <insert id="insertAuthRecord" parameterType="com.sincere.haikangface.bean.face.DeviceAuthRecord">
        insert into AC_DeviceAuthRecord
        (ShiDuan ,StudentType, SchoolId , Sno,StartTime , EndTime , State , WeekDays ,Sex,GrantState,AuthType,aType)
         values
        (#{shiduan},#{studentType}, #{schoolId}, #{sno}, #{startTime}, #{endTime}, 1, #{weekDays}, #{sex}, #{grantState},#{authType},#{aType})
    </insert>

    <select id="getAuthRecord" resultType="com.sincere.haikangface.bean.face.DeviceAuthRecord" parameterType="java.lang.Integer">
        select * from AC_DeviceAuthRecord where id = #{id}
    </select>

2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
50
51
52
53
54
55
56
57
    <select id="getAuthRecordBySchoolId" resultType="java.lang.Integer">
        select top 1 ShiDuan from AC_DeviceAuthRecord where SchoolId = #{schoolId} and StudentType = #{studentType}
        <if test="status != null">
            and State= #{status}
        </if>
        order by ShiDuan desc
    </select>

b8a3cdaf   徐泉   智能校卫一阶段代码提交
58
59
60
61
62
63
64
65
    <update id="deleteAuthRecord">
        update AC_DeviceAuthRecord set State = 0 where id = #{id}
    </update>

    <update id="updateAuthRecord">
        update AC_DeviceAuthRecord set GrantState = #{grantState} where id = #{id}
    </update>

86dc0d39   徐泉   智能校卫:海康、大华人脸机代码提交
66
    <select id="getStudentBySchoolId" resultType="com.sincere.haikangface.bean.StudentBean">
f1e0c386   徐泉   修改提交
67
68
69
70
71
         select * from SZ_V_School_Student where school_id = #{schoolId} and (student_num is not null or student_num !='') and (photo is not null or photo !='')
    </select>

    <select id="getStudentList" resultType="com.sincere.haikangface.bean.StudentBean">
        select * from SZ_V_School_Student where school_id = #{schoolId}
86dc0d39   徐泉   智能校卫:海康、大华人脸机代码提交
72
73
        <if test="studentType != null">
            and student_type = #{studentType}
2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
74
75
76
77
78
79
80
81
        </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 != '' and  photo !=''
6184590c   徐泉   海康大华接口提交
82
83
84
85
86
87
88
    </select>

    <select id="getStudentByClassId" resultType="com.sincere.haikangface.bean.StudentBean">
        select * from SZ_V_School_Student where school_id = #{schoolId}
        <if test="classIds != null and classIds.size() >0">
            and class_id in
            <foreach item="item" collection="classIds" separator="," open="(" close=")" index="">
2f519872   徐泉   修改提交
89
90
91
92
                #{item}
            </foreach>
        </if>
        <if test="studentType != null">
6184590c   徐泉   海康大华接口提交
93
94
95
            and student_type = #{studentType}
        </if>
        <if test="sexList != null and sexList.size() >0">
86dc0d39   徐泉   智能校卫:海康、大华人脸机代码提交
96
97
98
            and sex in
            <foreach item="item" collection="sexList" separator="," open="(" close=")" index="">
                #{item}
86dc0d39   徐泉   智能校卫:海康、大华人脸机代码提交
99
100
101
            </foreach>
        </if>
        and student_num != '' and  photo !=''
2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
102
103
104
    </select>

    <select id="getStudentCardGroup" resultType="com.sincere.haikangface.bean.StudentBean">
f1e0c386   徐泉   修改提交
105
106
       select * from SZ_V_School_Student where school_id = #{schoolId}
        <if test="studentType != null">
ad296f75   徐泉   智能校卫:海康、大华人脸机代码提交
107
            and student_type = #{studentType}
8b94a56a   徐泉   修改提交
108
109
110
111
112
113
114
115
116
117
118
119
120
        </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="groupId != null">
            and class_id in(select DISTINCT ClassId from SZ_OneCardGrouping where Pid = #{groupId} and state = 1)
        </if>
    </select>

    <select id="getTeacherList" resultType="com.sincere.haikangface.bean.StudentBean">
2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
121
122
        select * from SZ_V_School_Teacher where school_id = #{schoolId} and  teacher_num !='' and  face !=''
    </select>
2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
123
124
125
126
127
128
129

    <select id="getDeviceIds" resultType="java.lang.String">
        select clint_id from SZ_Attendance where clint_type in(22,18,28,29) and school_id = #{schoolId}
        <if test="deviceId != null and deviceId.trim() != ''">
            and clint_id = #{deviceId}
        </if>
    </select>
ad296f75   徐泉   智能校卫:海康、大华人脸机代码提交
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

    <update id="updateUser">
        update SZ_User set face = #{face} where user_id = #{userId}
    </update>

    <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>

    <insert id="insertCard" parameterType="com.sincere.haikangface.bean.UpdateCardBean">
        insert into HS_StudentUpdateCard
        (UserId ,CustomerId,StudentType,UserType,Name,ClassId,ClassName,OldCard ,Card,SchoolId,IsNew,UpdateType,AddTime ,Sex,Face,StudentCode,mobile)
         values
        (#{userId},#{customerId}, #{studentType}, #{userType}, #{name}, #{classId}, #{className}, #{oldCard}, #{card},#{schoolId},#{isNew},#{updateType}, #{addTime}, #{sex}, #{face}, #{studentCode}, #{mobile})
    </insert>
ad296f75   徐泉   智能校卫:海康、大华人脸机代码提交
147
148
149
150
151
152
153
154
155
156
157
158
159
160


    <select id="getStudentWithCard" resultType="com.sincere.haikangface.bean.StudentBean">
      select Top(1)* from SZ_V_School_Student where student_num = #{card}
        <if test="schoolId !=null">
            and school_id = #{schoolId}
        </if>
    </select>

    <select id="getTeacherWithCard" resultType="com.sincere.haikangface.bean.StudentBean">
       select Top(1)* from SZ_V_School_Teacher where teacher_num = #{teacher_num}
       <if test="schoolId !=null">
           and school_id = #{schoolId}
       </if>
2f519872   徐泉   修改提交
161
    </select>
ad296f75   徐泉   智能校卫:海康、大华人脸机代码提交
162
163
164
165
166
167
168
169
170
171
172
173

    <select id="getStudentCByUserId" resultType="com.sincere.haikangface.bean.StudentBean">
        select Top(1) * from SZ_V_School_Student where user_id = #{userId}
        <if test="schoolId !=null">
            and school_id = #{schoolId}
        </if>
    </select>

    <select id="getTeacherByUserId" resultType="com.sincere.haikangface.bean.StudentBean">
        select Top(1) * from SZ_V_School_Teacher where user_id = #{userId}
        <if test="schoolId !=null">
            and school_id = #{schoolId}
2cbbb164   徐泉   智能校卫:海康、大华人脸机代码提交
174
        </if>
8b94a56a   徐泉   修改提交
175
176
177
178
179
180
181
182
183
184
    </select>

    <resultMap id="BaseResultMap" type="com.sincere.haikangface.bean.test.SaveStudentBak">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" property="name"/>
        <result column="user_id" property="userId"/>
        <result column="card_num" property="cardNum"/>
0d72f97b   徐泉   修改提交
185
        <result column="class_name" property="className"/>
8b94a56a   徐泉   修改提交
186
187
188
189
190
191
192
193
194
195
196
        <result column="school_Id" property="schoolId"/>
        <result column="status" property="status"/>
        <result column="client_id" property="clientId"/>
    </resultMap>

    <insert id="insertStudent" parameterType="com.sincere.haikangface.bean.test.SaveStudentBak">
        insert into sz_student_bak values (#{name},#{userId},#{cardNum},#{clientId},#{className},#{status},#{schoolId})
    </insert>

    <select id="selectStudentList" resultMap="BaseResultMap">
        select * from sz_student_bak where status = 2
f1e0c386   徐泉   修改提交
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    </select>

    <update id="updateStudent" parameterType="java.lang.Integer">
        update sz_student_bak set status = 1 where id = #{id}
    </update>

    <select id="getRoomBySchoolId" resultType="java.lang.Integer">
        select Id from ss_room where schoolId = #{schoolId} and pId = #{groupId}
    </select>

    <select id="getStudentByRoomIds" resultType="com.sincere.haikangface.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">
9962583e   陶汉栋   no message
214
                and ssr.schoolId = #{schoolId}