无关风月
2025-07-23 7fd053651ac11db87fe4f6c57e65eed3b9a59452
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,
            tsai.max_num as maxNum,
            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
        WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 and tsai.end_time >= now()
          and tg.del_flag=0 and tg.status=2
        <if test="name != null and name != ''">
            AND tg.`name` LIKE concat('%',#{name},'%')
        </if>
        <if test="goodsCategoryId != null">
            AND tg.goods_category_id = #{goodsCategoryId}
        </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
        WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0
    </select>
    <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO">
        SELECT DISTINCT
        tsai.id,
        tg.id goodsId,
        tg.`name` goodsName,
        tg.introduction,
        tg.sale_num saleNum,
        tgc.`name` goodsCategoryName,
        tsai.max_num maxNum,
        tg.home_page_picture,
        tgse.selling_price activityPrice,
        tg.selling_price sellingPrice,
        tg.original_price,
        tsai.start_time,
        tsai.end_time,
        tsai.is_shelves showStatus,
        tgs.shop_id shopId,
        ts.name shopName
        FROM
        t_seckill_activity_info tsai
        LEFT JOIN t_goods tg ON tsai.good_id = tg.id
        LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id
        INNER  JOIN t_goods_shop tgs ON tg.id = tgs.goods_id
        INNER  JOIN t_shop ts ON tgs.shop_id = ts.id
        LEFT JOIN t_goods_seckill tgse ON tsai.id = tgse.seckill_activity_info_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.shopId != null">
            AND tgs.shop_id = #{goods.shopId}
        </if>
        <if test="goods.activityStatus != null and goods.activityStatus ==1">
            AND tsai.start_time <![CDATA[>]]> NOW()
        </if>
        <if test="goods.activityStatus != null and goods.activityStatus ==2">
            AND tsai.start_time <![CDATA[<=]]> NOW() AND tsai.end_time <![CDATA[>]]> NOW()
        </if>
        <if test="goods.activityStatus != null and goods.activityStatus ==3">
            AND tsai.end_time <![CDATA[<]]> NOW()
        </if>
        <if test="goods.status!= null ">
            and tsai.is_shelves =#{goods.status}
        </if>
        order by tsai.start_time desc
    </select>
</mapper>