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
<?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.TCoursePackageDiscountMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCoursePackageDiscount">
        <id column="id" property="id"/>
        <result column="coursePackageId" property="coursePackageId"/>
        <result column="coursePackagePaymentConfigId" property="coursePackagePaymentConfigId"/>
        <result column="type" property="type"/>
        <result column="content" property="content"/>
        <result column="auditStatus" property="auditStatus"/>
        <result column="auditUserId" property="auditUserId"/>
        <result column="auditRemark" property="auditRemark"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
 
    <select id="queryDiscountList" resultType="com.dsh.course.model.DiscountList">
        select t1.id,t1.type,t1.status,t2.province pName,t2.city cName,t2.name,t2.storeId,t2.id courseId
        from t_course_package_discount t1
        left join t_course_package t2 on t1.coursePackageId = t2.id
        where t2.storeId in
        <foreach collection="ids" close=")" item="id" open="(" separator=",">
            #{id}
        </foreach>
        <if test="pCode !=null and pCode !=''">
            and t2.provinceCode =#{pCode}
        </if>
        <if test="cCode !=null and cCode !=''">
            and t2.cityCode =#{cCode}
        </if>
        <if test="name !=null and name !=''">
            and t2.name like concat("%",#{name},"%")
        </if>
        <if test="type !=null ">
            and t1.type =#{type}
        </if>
        group by t1.coursePackageId
    </select>
 
 
    <select id="queryDiscountListAudit" resultType="com.dsh.course.model.DiscountList">
        select t1.id,t1.type,t1.auditStatus status,t2.province pName,t2.city cName,t2.name,
        t2.storeId,t2.id courseId
        from t_course_package_discount t1
        left join t_course_package t2 on t1.coursePackageId = t2.id
        where t2.storeId in <foreach collection="ids" close=")" item="id" open="(" separator=",">
        #{id}
    </foreach> and t1.auditStatus !=2
        <if test="pCode !=null and pCode !=''">
            and t2.provinceCode =#{pCode}
        </if>
        <if test="cCode !=null and cCode !=''">
            and t2.cityCode =#{cCode}
        </if>
        <if test="name !=null and name !=''">
            and t2.name like concat("%",#{name},"%")
        </if>
        <if test="type !=null ">
            and t1.type =#{type}
        </if>
        group by t1.coursePackageId
    </select>
</mapper>