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