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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?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.TCoursePackageMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCoursePackage">
        <id column="id" property="id"/>
        <result column="province" property="province"/>
        <result column="provinceCode" property="provinceCode"/>
        <result column="city" property="city"/>
        <result column="cityCode" property="cityCode"/>
        <result column="storeId" property="storeId"/>
        <result column="coursePackageTypeId" property="coursePackageTypeId"/>
        <result column="name" property="name"/>
        <result column="siteId" property="siteId"/>
        <result column="coachId" property="coachId"/>
        <result column="maxSubscribeNumber" property="maxSubscribeNumber"/>
        <result column="classStartTime" property="classStartTime"/>
        <result column="classEndTime" property="classEndTime"/>
        <result column="classWeeks" property="classWeeks"/>
        <result column="coverDrawing" property="coverDrawing"/>
        <result column="detailDrawing" property="detailDrawing"/>
        <result column="introduceDrawing" property="introduceDrawing"/>
        <result column="sort" property="sort"/>
        <result column="payType" property="payType"/>
        <result column="validDays" property="validDays"/>
        <result column="courseId" property="courseId"/>
        <result column="introduce" property="introduce"/>
        <result column="integral" property="integral"/>
        <result column="status" property="status"/>
        <result column="auditStatus" property="auditStatus"/>
        <result column="auditUserId" property="auditUserId"/>
        <result column="authRemark" property="authRemark"/>
        <result column="state" property="state"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
    <select id="queryStoreOfCourse" resultType="com.dsh.course.feignclient.model.CourseOfStoreVo">
        SELECT tcp.id     as courseId,
               tcp.`name` as courseName,
               tcp.classStartTime,
               tcp.classEndTime,
               tcp.classWeeks,
               ts.id      as storeId,
               ts.`name`  as storeName,
               ts.lat,
               ts.lon
        FROM playpai_course.t_course_package as tcp
                 JOIN playpai_other.t_store as ts ON tcp.storeId = ts.id
        where tcp.`status` = 1
          and tcp.auditStatus = 2
          and tcp.`state` = 1
          and ts.`state` = 1
    </select>
 
 
    <select id="queryCoursePackageLists" resultType="map">
        select
        a.id,
        CONCAT(a.province, a.city) as city,
        a.storeId,
        b.`name` as coursePackageType,
        a.`name`,
        a.maxSubscribeNumber,
        CONCAT('购买后', a.validDays, '天内有效') as validDays,
        a.sort,
        a.`status`,
        a.state,
        a.type
        from t_course_package a
        left join t_course_package_type b on (a.coursePackageTypeId = b.id)
        where a.state != 3 and a.auditStatus = 2
        <if test="null != item.provinceCode and '' != item.provinceCode">
            and a.provinceCode = #{item.provinceCode}
        </if>
        <if test="null != item.cityCode and '' != item.cityCode">
            and a.cityCode = #{item.cityCode}
        </if>
        <if test="null != item.coursePackageTypeId">
            and a.coursePackageTypeId = #{item.coursePackageTypeId}
        </if>
        <if test="item.storeIds != null and item.storeIds.size()>0">
            AND a.storeId IN
            <foreach collection="item.storeIds" separator="," item="id" open="(" close=")">
                #{id}
            </foreach>
        </if>
        <if test="null != item.name and '' != item.name">
            and a.name like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.status">
            and a.status = #{item.status}
        </if>
        <if test="null != item.state">
            and a.state = #{item.state}
        </if>
        order by a.insertTime desc
    </select>
 
 
    <select id="queryExamineCoursePackageLists" resultType="map">
        select
        a.id,
        CONCAT(a.province, a.city) as city,
        a.storeId,
        b.`name` as coursePackageType,
        a.`name`,
        a.maxSubscribeNumber,
        CONCAT('购买后', a.validDays, '天内有效') as validDays,
        a.sort,
        a.auditStatus
        from t_course_package a
        left join t_course_package_type b on (a.coursePackageTypeId = b.id)
        where a.state = 1 and a.auditStatus != 2
        <if test="null != item.provinceCode and '' != item.provinceCode">
            and a.provinceCode = #{item.provinceCode}
        </if>
        <if test="null != item.cityCode and '' != item.cityCode">
            and a.cityCode = #{item.cityCode}
        </if>
        <if test="null != item.coursePackageTypeId">
            and a.coursePackageTypeId = #{item.coursePackageTypeId}
        </if>
        <if test="null != item.name and '' != item.name">
            and a.name line CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.auditStatus">
            and a.auditStatus = #{item.auditStatus}
        </if>
        order by a.insertTime desc
    </select>
    <select id="queryByConfigId" resultType="java.util.Map">
        select id,classHours from t_course_package_payment_config where coursePackageId =#{oneId}
    </select>
    <select id="getHours" resultType="java.lang.Integer">
        select classHours from t_course_package_payment_config where coursePackageId =#{coursePackageId}
    </select>
 
</mapper>