xiaoyong931011
2023-08-29 eac9127fec0c66863b54a3801e093335d69a55b1
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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="cc.mrbird.febs.dapp.mapper.MallGoodsMapper">
 
    <select id="selectMallGoodsInPage" resultType="cc.mrbird.febs.dapp.entity.MallGoods">
        select
        a.*,
        b.name categoryName
        from mall_goods a
        left join mall_goods_category b on a.category_id = b.id
        <where>
            <if test="record != null">
                <if test="record.goodsName != null and record.goodsName != ''">
                    and a.goods_name like CONCAT('%', CONCAT(#{record.goodsName}, '%'))
                </if>
            </if>
        </where>
        group by a.id
        order by a.sort_cnt asc
    </select>
 
    <select id="selectMallGoodsCountByGoodsName" resultType="java.lang.Integer">
        select count(id) from mall_goods a where a.goods_name = #{goodsName}
    </select>
 
 
 
    <select id="selectMallGoodsCountByGoodsNameAndGoodId" resultType="java.lang.Integer">
        select count(id) from mall_goods a where a.goods_name = #{goodsName} and a.id != #{id}
    </select>
 
    <select id="selectMallGoodsCountByGoodsNo" resultType="java.lang.Integer">
        select count(id) from mall_goods a where a.goods_no = #{goodsNo}
    </select>
 
    <select id="selectMallGoodsCountByGoodsNoAndGoodId" resultType="java.lang.Integer">
        select count(id) from mall_goods a where a.goods_no = #{goodsNo} and a.id != #{id}
    </select>
 
    <select id="selectGoodsStockAndVolume" resultType="java.util.HashMap">
        select
            sum(stock) stock,
            sum(sku_volume) volume
        from mall_goods_sku
        where goods_id=#{id}
    </select>
 
    <select id="selectOrderListInPage" resultType="cc.mrbird.febs.dapp.entity.MallOrderInfo">
        select a.*,
        b.address address,
        c.goods_name
        from mall_order_item c
        left join mall_order_info a on a.id = c.order_id
        left join dapp_member b on a.member_id = b.id
        <where>
            <if test="record != null">
                <if test="record.goodsName != null and record.goodsName != ''">
                    and c.goods_name like CONCAT('%', CONCAT(#{record.goodsName}, '%'))
                </if>
                <if test="record.deliverType != null and record.deliverType != ''">
                    and a.deliver_type = #{record.deliverType}
                </if>
                <if test="record.orderType != null">
                    and a.order_type = #{record.orderType}
                </if>
                <if test="record.status != null and record.status != ''">
                    and a.status = #{record.status}
                </if>
                <if test="record.deliverState != null and record.deliverState != ''">
                    and a.deliver_state = #{record.deliverState}
                </if>
                <if test="record.orderNo != null and record.orderNo != ''">
                    and a.order_no like CONCAT('%', CONCAT(#{record.orderNo}, '%'))
                </if>
                <if test="record.name != null and record.name != ''">
                    and b.address like CONCAT('%', CONCAT(#{record.name}, '%'))
                </if>
                <if test="record.startTime != null and record.startTime != ''">
                    and a.order_time &gt;= #{record.startTime}
                </if>
                <if test="record.endTime != null and record.endTime != ''">
                    and a.order_time &lt;= #{record.endTime}
                </if>
            </if>
        </where>
        order by a.create_time desc
    </select>
 
    <select id="selectMallGoodsByCategaryId" resultType="cc.mrbird.febs.dapp.entity.MallGoods">
        select * from mall_goods a where a.category_id = #{categaryId}
    </select>
 
    <select id="getMallOrderInfoById" resultType="cc.mrbird.febs.dapp.vo.AdminMallOrderVo">
        select b.* from mall_address_info b
        where b.id = (select a.address_id from mall_order_info a where a.id = #{id})
    </select>
 
</mapper>