Browse Source

fixed 删除店铺关联操作

fushengqian 1 month ago
parent
commit
6c9d40e7d7

+ 1 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/CateServiceImpl.java

@@ -258,8 +258,7 @@ public class CateServiceImpl extends ServiceImpl<MtGoodsCateMapper, MtGoodsCate>
                     .eq(MtGoodsCate::getStoreId, storeId));
         }
         lambdaQueryWrapper.orderByAsc(MtGoodsCate::getSort);
-        List<MtGoodsCate> dataList = cateMapper.selectList(lambdaQueryWrapper);
-        return dataList;
+        return cateMapper.selectList(lambdaQueryWrapper);
     }
 
     /**

+ 8 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/StoreServiceImpl.java

@@ -17,6 +17,7 @@ import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.repository.bean.StoreDistanceBean;
 import com.fuint.repository.mapper.MtMerchantMapper;
+import com.fuint.repository.mapper.MtStoreGoodsMapper;
 import com.fuint.repository.mapper.MtStoreMapper;
 import com.fuint.repository.model.MtMerchant;
 import com.fuint.repository.model.MtStore;
@@ -52,6 +53,8 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
 
     private MtMerchantMapper mtMerchantMapper;
 
+    private MtStoreGoodsMapper mtStoreGoodsMapper;
+
     /**
      * 商户接口
      */
@@ -326,6 +329,11 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
         mtStore.setUpdateTime(new Date());
         mtStore.setOperator(operator);
 
+        // 删除店铺
+        if (status.equals(StatusEnum.DISABLE.getKey())) {
+            mtStoreGoodsMapper.removeStoreGoods(id);
+        }
+
         mtStoreMapper.updateById(mtStore);
     }
 

+ 4 - 1
fuint-repository/src/main/java/com/fuint/repository/mapper/MtStoreGoodsMapper.java

@@ -2,6 +2,7 @@ package com.fuint.repository.mapper;
 
 import com.fuint.repository.model.MtStoreGoods;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 店铺商品 Mapper 接口
@@ -11,4 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MtStoreGoodsMapper extends BaseMapper<MtStoreGoods> {
 
-}
+    void removeStoreGoods(@Param("storeId") Integer storeId);
+
+}

+ 4 - 2
fuint-repository/src/main/resources/mapper/MtStoreGoodsMapper.xml

@@ -1,5 +1,7 @@
 <?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.fuint.repository.mapper.MtStoreGoodsMapper}">
-
+<mapper namespace="com.fuint.repository.mapper.MtStoreGoodsMapper">
+    <update id="removeStoreGoods">
+        update mt_store_goods set STATUS = 'D' where STORE_ID = #{storeId}
+    </update>
 </mapper>