puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
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
<?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.CoursePackagePaymentConfigMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.CoursePackagePaymentConfig">
        <id column="id" property="id"/>
        <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"/>
    </resultMap>
    <update id="changeState">
        update t_course_package_order set
        payStatus = 2,payUserName = #{payUserName},payType = 7,payUserId=#{payUserId},
        payUserType = 2
        <where>
            <if test="ids!=null and ids!= ''">
                and t_course_package_order.id = #{ids}
            </if>
        </where>
    </update>
 
    <select id="listAll" resultType="com.dsh.course.model.CoursePackagePaymentVO">
        select
        t1.id,t1.payUserType,t1.payStatus,t1.payType,t1.originalPrice,t1.userCouponId,t1.payUserId,t1.studentIds as studentId,t1.appUserId,t1.cashPayment,t1.playPaiCoin,
        t1.payUserName as buyTypeName, t1.classHours as classHours,t1.insertTime as insertTime,t1.coursePackageId as coursePackageId,
        CONCAT(t2.province,t2.city) as provinceAndCity,t2.coursePackageTypeId,t2.storeId,t2.name as coursePackage,
        t3.name as coursePackageType
        from t_course_package_order t1
        left join t_course_package t2 on t1.coursePackageId = t2.id
        left join t_course_package_type t3 on t2.coursePackageTypeId = t3.id
        <where>
            <if test="query.province!=null and query.province!= ''">
                and t2.province = #{query.province}
            </if>
            <if test="query.city!=null and query.city!= ''">
                and t2.city = #{query.city}
            </if>
            <if test="query.coursePackageTypeId!=null and query.coursePackageTypeId!= ''">
                and t3.id = #{query.coursePackageTypeId}
            </if>
            <if test="query.coursePackageTypeName!=null and query.coursePackageTypeName!= ''">
                and t2.name like concat('%',#{query.coursePackageTypeName},'%')
            </if>
            <if test="query.storeIds != null and query.storeIds.size>0">
                AND t2.storeId IN
                <foreach collection="query.storeIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="query.payStatus!=null and query.payStatus!= ''">
                and t1.payStatus = #{query.payStatus}
            </if>
            <if test="query.ids !=null and query.ids.size >0">
                and t2.id in
                <foreach collection="query.ids" close=")" item="id" open="(" separator=",">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>
    <select id="listAllRegister" resultType="com.dsh.course.model.RegisterOrderVO">
        select
        t1.id,t1.studentIds,t1.payUserType,t1.payStatus,t1.payType,t1.originalPrice,t1.userCouponId,t1.payUserId,t1.appUserId,t1.cashPayment
        as money,t1.playPaiCoin,
        t1.insertTime,
        CONCAT(t2.province,t2.city) as provinceAndCity,t2.coursePackageTypeId,t2.storeId,t2.name as coursePackageName
        from t_course_package_order t1
        left join t_course_package t2 on t1.coursePackageId = t2.id
        <where>
            <if test="query.amount!=null and query.amount!= ''">
                and t1.cashPayment &lt;= #{query.amount}
            </if>
            <if test="query.province!=null and query.province!= ''">
                and t2.provinceCode = #{query.province}
            </if>
            <if test="query.city!=null and query.city!= ''">
                and t2.cityCode = #{query.city}
            </if>
            <if test="query.storeId!=null and query.storeId!= ''">
                and t2.storeId = #{query.storeId}
            </if>
            <if test="sTime !=null and sTime!= '' and eTime !=null and eTime!= ''">
                and t1.insertTime between #{sTime} and #{eTime}
            </if>
            <if test="query.storesIds != null and query.storesIds.size()>0">
                AND t2.storeId IN
                <foreach collection="query.storesIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="query.userIds != null and query.userIds.size()>0">
                AND t1.appUserId IN
                <foreach collection="query.userIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
 
            <if test="query.studentIds != null and query.studentIds.size()>0">
                AND t1.studentId IN
                <foreach collection="query.studentIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="query.coursePackageName!=null and query.coursePackageName!= ''">
                AND t2.name LIKE concat('%',#{query.coursePackageName},'%')
            </if>
            <if test="query.salesName!=null and query.salesName!= ''">
                AND t1.salesName LIKE concat('%',#{query.salesName},'%')
            </if>
 
            <if test="query.orderSource!=null and query.orderSource!= ''">
                and t1.payUserType = #{query.orderSource}
            </if>
            and t1.payStatus = 2
        </where>
        order by t1.insertTime desc
    </select>
 
</mapper>