puzhibing
2023-12-04 3ad6b6ba2ba56fc0bcd2130e47190779c6e15acc
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
<?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.dsh.course.mapper.CoursePackageStudentMapper">
    <update id="updateSignInOrNotById">
        update t_course_package_student set signInOrNot = 2 where id =#{id}
    </update>
 
 
    <select id="queryCoursePackageStudentList" resultType="map">
        select
        CAST(id AS CHAR(20)) as id,
        appUserId,
        studentId,
        signInOrNot,
        reservationStatus
        from t_course_package_student where 1=1
        <if test="ids != null and ids.size() > 0">
            and coursePackageSchedulingId in
            <foreach collection="ids" close=")" item="id" open="(" separator=",">
                #{id}
            </foreach>
        </if>
 
        and reservationStatus != 3
        <if test="null != userId">
            and appUserId in
            <foreach collection="appUserId" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != studentId">
            and studentId in
            <foreach collection="studentId" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by insertTime desc
    </select>
 
    <select id="listAll" resultType="com.dsh.course.entity.StudentClassInfo">
        SELECT
            SUM( py.totalClassHours ) AS totalHours,
            SUM( py.laveClassHours ) AS restHours,
            SUM( py.giftClassHours ) as giftHours
        FROM
            t_course_package_order_student  py
 
           where  py.studentId = #{tStudentId}
 
    </select>
 
    <select id="getClassList" resultType="com.dsh.course.entity.dto.ClassListDto">
 
        SELECT
        *,
        pg.NAME AS className,
        pg.`type` AS classType
        FROM
        t_course_package_order_student py
        LEFT JOIN t_course_package pg ON py.coursePackageId = pg.id
 
        <where>
              py.status = 1
            <if test="null != tStudentId">
                and py.studentId = #{tStudentId}
            </if>
            and pg.type!=3
        </where>
    </select>
    <select id="getMaxDate" resultType="java.util.Date">
        SELECT
            MAX(useTime)
        FROM t_course_package_payment py
        where py.studentId = #{tStudentId}
    </select>
    <select id="getHoliList" resultType="com.dsh.course.entity.dto.ClassListDto">
        select
            od.id,od.insertTime as insertTime, cp.name as className,cp.type as classType
        from t_course_package_order od
                 left join t_course_package cp on od.coursePackageId = cp.id
 
        WHERE            od.payStatus = 2  and cp.type = 2
 
 
 
    </select>
</mapper>