<?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>
|