liujie
4 天以前 67d06a785d5fc4524639ace27651c01ff05a4b58
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
<?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.ruoyi.other.mapper.TGoodsMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.other.api.domain.TGoods">
        <id column="id" property="id" />
        <result column="type" property="type" />
        <result column="name" property="name" />
        <result column="cover_picture" property="coverPicture" />
        <result column="details_picture" property="detailsPicture" />
        <result column="dispatch_address" property="dispatchAddress" />
        <result column="service_description" property="serviceDescription" />
        <result column="original_price" property="originalPrice" />
        <result column="preferential_price" property="preferentialPrice" />
        <result column="vip_price" property="vipPrice" />
        <result column="redeem_points" property="redeemPoints" />
        <result column="limit_exchange_times" property="limitExchangeTimes" />
        <result column="inventory" property="inventory" />
        <result column="underlying_sales" property="underlyingSales" />
        <result column="describe" property="describe" />
        <result column="introduce" property="introduce" />
        <result column="explain" property="explain" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, type, name, cover_picture, details_picture, dispatch_address, service_description, original_price, preferential_price, vip_price, redeem_points, limit_exchange_times, inventory, underlying_sales, describe, introduce, explain, status, create_time, del_flag
    </sql>
    <select id="pageList" resultType="com.ruoyi.other.api.domain.TGoods">
        select * from t_goods
        <where>
            <if test="req.name != null and req.name != ''">
                AND  `name` LIKE concat('%',#{req.name}, '%')
            </if>
            <if test="req.type != null">
                AND  `type` = #{req.type}
            </if>
            <if test="req.status != null">
                AND  status = #{req.status}
            </if>
            <if test="req.otherState != null and req.otherState == 2">
                AND  inventory = 0
            </if>
            <if test="req.otherState != null and req.otherState ==3">
                AND  status = 2
            </if>
            AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
        </where>
        ORDER BY create_time DESC
    </select>
 
    <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods">
        SELECT
            id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales
        FROM
            t_goods
        WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type}
        UNION ALL
        SELECT
            id,
            NAME,
            redeem_points AS redeemPoints,
            inventory_quantity AS inventory,
            payment_amount AS originalPrice,
            payment_amount AS preferentiaPrice,
            vip_payment_amount AS vipPrice,
            2 AS goodType,
            cover_picture AS coverPicture,
            0 AS underlyingSales
        FROM
            t_coupon
        WHERE
            `status` = 1
          AND del_flag = 0 and ways_to_obtain != #{appGoodQuery.type}
          AND (
            validity_period_mode != 1
        OR (validity_period_mode = 1 AND end_time >= NOW())
            )
        ORDER BY
            CASE
                WHEN `inventory` = 0 THEN 0
                ELSE 1
                END DESC,
            `redeemPoints` ASC
    </select>
 
</mapper>