usermapper.xml 2.76 KB
<?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} or StudentType =3)
        </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="getStudentByClassId" resultType="com.example.dahua.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="">
                #{item}
            </foreach>
        </if>
        and student_num != '' and  photo !=''
    </select>

</mapper>