<?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.GoodsMapper">
|
|
<select id="selectListByShopId" resultType="com.ruoyi.other.vo.GoodsVO">
|
SELECT distinct
|
tg.id as goodsId,
|
tg.`name` as goodsName,
|
tg.purchase_limit as purchaseLimit,
|
tg.integral,
|
tg.introduction,
|
tg.selling_price as sellingPrice,
|
tg.original_price as originalPrice,
|
tg.sale_num as saleNum,
|
tg.home_page_picture as homePagePicture,
|
tg.sort
|
FROM t_goods tg
|
where tg.del_flag = 0 and tg.status = 2 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId})
|
ORDER BY ifnull(tg.sort, -1) DESC
|
</select>
|
<select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
|
SELECT
|
tg.*,
|
ts.name AS shop_name,
|
ts.id AS shop_id,
|
tgc.name AS category_name
|
FROM
|
t_goods_shop tgs
|
LEFT JOIN t_goods tg ON tgs.goods_id = tg.id
|
LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id
|
LEFT JOIN t_shop ts ON tgs.shop_id = ts.id
|
<where>
|
tg.del_flag = 0
|
<if test="goods.id != null">
|
AND tg.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.status != null">
|
AND tg.`status` = #{goods.status}
|
</if>
|
<if test="goods.shopName != null and goods.shopName != ''">
|
AND ts.`name` LIKE CONCAT('%', #{goods.shopName}, '%')
|
</if>
|
<if test="goods.shopId != null">
|
AND ts.id = #{goods.shopId}
|
</if>
|
</where>
|
ORDER BY IFNULL(tg.sort,0) DESC
|
</select>
|
|
|
|
<select id="goodsList" resultType="com.ruoyi.other.vo.GoodsVO">
|
select g.id as goodsId,
|
g.name as goodsName,
|
g.purchase_limit as purchaseLimit,
|
g.selling_price as sellingPrice,
|
g.type,
|
g.original_price as originalPrice,
|
g.integral,
|
g.introduction,
|
g.home_page_picture as homePagePicture,
|
g.sale_num as saleNum
|
from t_goods g
|
<if test="null != shopIds and shopIds.size() > 0">
|
inner join t_goods_shop gs on g.id = gs.goods_id
|
</if>
|
where g.status = 2 and g.del_flag = 0
|
<if test="null != goodsCategoryId">
|
and g.goods_category_id = #{goodsCategoryId}
|
</if>
|
<if test="null != name and '' != name">
|
and g.name like CONCAT('%', #{name}, '%')
|
</if>
|
<if test="null != shopIds and shopIds.size() > 0">
|
and gs.shop_id in
|
<foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
|
#{shopId}
|
</foreach>
|
</if>
|
order by g.sale_num desc
|
</select>
|
</mapper>
|