1
phpcjl
2024-12-20 d51a8cfa10c34d9c1e7d6b4726d31e75ecee5dc6
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
<?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,
            tg.original_price,
            tg.sale_num,
            tg.home_page_picture
        FROM
            t_shop ts
                LEFT JOIN t_goods_shop tgs ON ts.id = tgs.shop_id
                LEFT JOIN t_goods tg ON tg.id = tgs.goods_id
        where ts.id = #{shopId} and ts.del_flag = 0
        <if test="vip != null">
            and FIND_IN_SET(#{vip}, commodity_authority) > 0
        </if>
        ORDER BY tg.sale_num DESC
    </select>
    <select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
        SELECT
            tg.id,
            tg.`name`,
            tg.type,
            tg.goods_category_id,
            tgc.`name`,
            tg.operating_cost,
            tg.shop_cost,
            tg.`status`,
            tg.purchase_limit,
            tg.sale_num,
            tg.cash_payment,
            tg.point_payment
        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>
        </where>
    </select>
</mapper>