Pu Zhibing
2025-04-22 fd7b8fb7c89832c28a838b0449bbb8a392433ee2
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
<?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.SeckillActivityInfoMapper">
 
    <select id="listSeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO">
        SELECT
            tsai.id,
            tg.id as goodsId,
            tg.`name` as goodsName,
            tg.introduction,
            tg.home_page_picture as homePagePicture,
            tg.original_price as originalPrice,
            tgs.selling_price as sellingPrice,
            tgs.integral as integral,
            tg.sale_num as saleNum,
            tg.type goodsType,
            tsai.start_time as startTime,
            tsai.end_time as endTime
        FROM
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vipId}
        WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and tsai.end_time >= now()
        <if test="name != null and name != ''">
            AND tg.`name` LIKE concat('%',#{name},'%')
        </if>
        <if test="goodsCategoryId != null">
            AND tg.goods_category_id = #{goodsCategoryId}
        </if>
        <if test="vipId != null">
            AND tgs.vip in (0, -1, #{vipId})
        </if>
        <if test="vipId == null">
            AND tgs.vip in (0, -1)
        </if>
    </select>
    <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO">
        SELECT
            tsai.id,
            tsai.good_id as goodsId,
            tg.`name`,
            tg.introduction,
            tg.home_page_picture as homePagePicture,
            tg.original_price as originalPrice,
            tgs.selling_price as sellingPrice,
            tgs.integral,
            tg.sale_num as saleNum,
            tsai.start_time as startTime,
            tg.detail_picture as detailPicture,
            tsai.end_time as endTime,
            tsai.max_num as maxNum,
            tg.detail
        FROM
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vip}
        WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0
    </select>
    <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO">
        SELECT
        tsai.id,
        tg.id goodsId,
        tg.`name` goodsName,
        tg.introduction,
        tgc.`name` goodsCategoryName,
        tg.operating_cost,
        tg.shop_cost,
        tsai.max_num maxNum,
        tg.home_page_picture,
        tg.original_price,
        tg.`type` goodsType,
        tsai.start_time,
        tsai.end_time,
        tsai.is_shelves showStatus
        FROM
        t_seckill_activity_info tsai
        LEFT JOIN t_goods tg ON tsai.good_id = tg.id
        LEFT JOIN t_goods_category tgc ON tgc.id = tg.goods_category_id
        WHERE tsai.del_flag = 0
        <if test="goods.id != null">
            AND tsai.id = #{goods.id}
        </if>
        <if test="goods.name != null and goods.name != ''">
            AND tg.`name` LIKE concat('%',#{goods.name},'%')
        </if>
        <if test="goods.goodsCategoryId != null">
            AND tg.goods_category_id = #{goods.goodsCategoryId}
        </if>
        <if test="goods.categoryName != null and goods.categoryName != ''">
            AND tgc.name = #{goods.categoryName}
        </if>
        <if test="goods.showStatus != null">
            AND tsai.is_shelves = #{goods.showStatus}
        </if>
        <if test="goods.type != null">
            AND tg.type = #{goods.type}
        </if>
        <if test="goods.status != null and goods.status ==1">
            AND tsai.start_time <![CDATA[>]]> NOW()
        </if>
        <if test="goods.status != null and goods.status ==2">
            AND tsai.start_time <![CDATA[<=]]> NOW() AND tsai.end_time <![CDATA[>]]> NOW()
        </if>
        <if test="goods.status != null and goods.status ==3">
            AND tsai.end_time <![CDATA[<]]> NOW()
        </if>
        <if test="goods.vipId != null">
            AND find_in_set(#{goods.vipId},tgs.vip) > 0
        </if>
        order by tsai.create_time desc
    </select>
</mapper>