From 722f17e0fc6a1fbe709bd02bbb7c75b8da435e07 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 10 May 2022 15:20:50 +0800
Subject: [PATCH] add score goods-list and goods-add

---
 src/main/resources/mapper/modules/MallGoodsMapper.xml |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallGoodsMapper.xml b/src/main/resources/mapper/modules/MallGoodsMapper.xml
index 1ecb522..bf6af19 100644
--- a/src/main/resources/mapper/modules/MallGoodsMapper.xml
+++ b/src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -74,6 +74,12 @@
                     <if test="record.isHot != null and record.isHot != ''">
                         and a.is_hot = 1
                     </if>
+                    <if test="record.isNormal != null and record.isNormal != ''">
+                        and a.is_normal = #{record.isNormal}
+                    </if>
+                    <if test="record.goodsType != null and record.goodsType != ''">
+                        and a.goods_type = #{record.goodsType}
+                    </if>
                     <if test="record.categoryId != null and record.categoryId != ''">
                         and (c.id = #{record.categoryId} or c.parent_id=#{record.categoryId})
                     </if>
@@ -117,9 +123,10 @@
         a.original_price,
         a.present_price,
         a.is_hot,
+        a.score,
         b.name categaryName,
-        sum(c.sku_volume) skuVolume,
-        sum(c.stock) stock
+        IFNULL(sum(c.sku_volume), a.volume) skuVolume,
+        IFNULL(sum(c.stock), a.stock) stock
         from mall_goods a
         left join mall_goods_category b on b.id = a.category_id
         left join mall_goods_sku c on c.goods_id = a.id
@@ -128,8 +135,12 @@
                 <if test="record.goodsName != null and record.goodsName != ''">
                     and a.goods_name like CONCAT('%', CONCAT(#{record.goodsName}, '%'))
                 </if>
+                <if test="record.goodsType != null and record.goodsType != ''">
+                    and a.goods_type=#{record.goodsType}
+                </if>
             </if>
         </where>
+        group by a.id
         order by a.created_time desc
     </select>
 
@@ -137,8 +148,18 @@
         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="selectMallGoodsInfoById" resultType="cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo">
@@ -152,4 +173,19 @@
         from mall_goods_sku
         where goods_id=#{id}
     </select>
+
+    <select id="selectMallGoodsByCategaryId" resultType="cc.mrbird.febs.mall.entity.MallGoods">
+        select * from mall_goods a where a.category_id = #{categaryId}
+    </select>
+
+    <select id="getMallGoodsUpdateInfoById" resultType="cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo">
+        select * from mall_goods a where a.id = #{id}
+    </select>
+
+    <select id="getAllGoodsTree" resultType="cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo">
+        select
+               a.id  goodsId,
+               a.goods_name  goodsName
+        from mall_goods a
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1