<?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.api.domain.Goods">
|
SELECT
|
tg.id,
|
tg.`name`,
|
tg.type,
|
tg.introduction,
|
tg.selling_price as sellingPrice,
|
tg.original_price as originalPrice,
|
tg.integral as integral,
|
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.appoint_store = 2 or (tg.appoint_store = 1 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId})))
|
and tg.type = 1
|
<if test="vip != null">
|
and (tg.commodity_authority like '%-1%' or tg.commodity_authority like CONCAT('%', #{vip}, '%'))
|
</if>
|
ORDER BY ifnull(tg.sort, -1) DESC
|
</select>
|
<select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
|
SELECT
|
tg.*
|
FROM
|
t_goods tg
|
LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.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.type != null">
|
and tg.type = #{goods.type}
|
</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.payMethod != null and goods.payMethod == 1 ">
|
and tg.`cash_payment` = 1 and (tg.`point_payment` = 0 or tg.`point_payment` is null)
|
</if>
|
<if test="goods.payMethod != null and goods.payMethod == 2 ">
|
and tg.`point_payment` = 1 and (tg.`cash_payment` = 0 or tg.`cash_payment` is null)
|
</if>
|
<if test="goods.payMethod != null and goods.payMethod == 3 ">
|
and (tg.`point_payment` = 1 and tg.`cash_payment` = 1 )
|
</if>
|
|
</where>
|
order by tg.sort desc
|
</select>
|
|
|
<select id="goodsList" resultType="com.ruoyi.other.vo.GoodsVO">
|
select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 and `type` = 2
|
<if test="null != goodsCategoryId">
|
and goods_category_id = #{goodsCategoryId}
|
</if>
|
<if test="null != name and '' != name">
|
and name like CONCAT('%', #{name}, '%')
|
</if>
|
<if test="null != vip">
|
and (FIND_IN_SET(#{vip}, commodity_authority) or commodity_authority like '%-1%')
|
</if>
|
order by sort desc
|
</select>
|
</mapper>
|