liujie
2023-09-16 1aa309700fb7e12d85f98bed22a45bdac448ec1c
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
<?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.TCoursePackagePaymentMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCoursePackagePayment">
        <id column="id" property="id" />
        <result column="appUserId" property="appUserId" />
        <result column="studentId" property="studentId" />
        <result column="coursePackageId" property="coursePackageId" />
        <result column="payType" property="payType" />
        <result column="classHours" property="classHours" />
        <result column="cashPayment" property="cashPayment" />
        <result column="playPaiCoin" property="playPaiCoin" />
        <result column="totalClassHours" property="totalClassHours" />
        <result column="laveClassHours" property="laveClassHours" />
        <result column="absencesNumber" property="absencesNumber" />
        <result column="payUserType" property="payUserType" />
        <result column="payStatus" property="payStatus" />
        <result column="orderNumber" property="orderNumber" />
        <result column="payUserId" property="payUserId" />
        <result column="status" property="status" />
        <result column="withdrawalTime" property="withdrawalTime" />
        <result column="certificate" property="certificate" />
        <result column="state" property="state" />
        <result column="insertTime" property="insertTime" />
    </resultMap>
 
 
    <select id="queryCountNumber" resultType="int">
        SELECT
        count( 1 ) AS num
        FROM (
          SELECT appUserId FROM t_course_package_payment WHERE payStatus = 2 AND state = 1 and coursePackageId = #{coursePackageId} GROUP BY appUserId
        ) AS aa
    </select>
 
 
    <select id="getCoursePackagePaymentByCode" resultType="com.dsh.course.entity.TCoursePackagePayment">
    select * from t_course_package_payment where 1=1
    <if test="code != null">
        and `code` = #{code}
    </if>
    </select>
 
    <select id="billingDataRequestVo" resultType="com.dsh.course.model.BillingRequest">
        SELECT DATE_FORMAT(payTime, '%m-%d %H:%i')as `time`,
        amount
        from t_course_package_payment
        where  payStatus = 2 and state = 1 and payType = 3
        <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
            and DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
        </if>
        <if test="null != appUserId and '' != appUserId ">
            and appUserId = #{appUserId}
        </if>
    </select>
 
 
 
    <select id="queryRegistrationRecord" resultType="map">
        select
        CAST(id AS CHAR(20)) as id,
        appUserId,
        studentId,
        DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime,
        totalClassHours,
        absencesNumber,
        `status`
        from t_course_package_payment where payStatus = 2 and state = 1
        <if test="null != coursePackageId">
            and coursePackageId = #{coursePackageId}
        </if>
        <if test="null != userIds">
            and appUserId in
            <foreach collection="userIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != studentIds">
            and studentId in
            <foreach collection="studentIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by insertTime desc
    </select>
 
 
    <select id="queryWalkInStudentList" resultType="map">
        select
        CAST(id AS CHAR(20)) as id,
        appUserId,
        studentId
        from t_course_package_payment where payStatus = 2 and state = 1
        <if test="null != coursePackageId">
            and coursePackageId = #{coursePackageId}
        </if>
        <if test="null != coursePackagePaymentId">
            and id not in
            <foreach collection="coursePackagePaymentId" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != userIds">
            and appUserId in
            <foreach collection="userIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        <if test="null != studentIds">
            and studentId in
            <foreach collection="studentIds" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by insertTime desc
    </select>
</mapper>