Преглед изворни кода

小程序-根据商铺id查看消息订阅,小程序-修改消息订阅

liu пре 1 година
родитељ
комит
41c859f2f2

+ 1 - 1
db/update_241024.sql

@@ -1,3 +1,3 @@
-ALTER TABLE goods_shop ADD message_configuration int COMMENT '消息配置  0开  1关闭';
+ALTER TABLE goods_shop ADD message_configuration int COMMENT '消息配置  0开  1关闭';
 
 UPDATE goods_shop SET message_configuration= 0;

+ 13 - 0
src/main/java/com/sqx/modules/goods/controller/app/AppGoodsController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.app.annotation.Login;
 import com.sqx.modules.goods.dto.ShopQueryDTO;
+import com.sqx.modules.goods.entity.GoodsShop;
 import com.sqx.modules.goods.service.GoodsService;
 import com.sqx.modules.goods.service.GoodsShopService;
 import com.sqx.modules.shop.service.SearchHistoryService;
@@ -101,6 +102,18 @@ public class AppGoodsController {
         return goodsService.selectSupplierShop(queryDTO);
     }
 
+    @ApiOperation("根据商铺id查看消息订阅")
+    @GetMapping(value = "/selectGoodShop")
+    public Result selectGoodShop(Long shopId){
 
+        return goodsService.selectGoodShop(shopId);
+    }
+
+    @ApiOperation("修改消息订阅")
+    @PostMapping(value = "/updateGoodShop")
+    public Result updateGoodShop(@RequestBody GoodsShop goodsShop){
+
+        return goodsService.updateGoodShop(goodsShop);
+    }
 
 }

+ 1 - 1
src/main/java/com/sqx/modules/goods/entity/GoodsShop.java

@@ -259,6 +259,6 @@ public class GoodsShop implements Serializable {
     @ApiModelProperty("是否供应商 0是  1不是")
     private Integer isSupplier;
 
-    @ApiModelProperty("消息配置  0开  1关闭")
+    @ApiModelProperty("消息配置  0开  1关闭")
     private Integer messageConfiguration;
 }

+ 5 - 0
src/main/java/com/sqx/modules/goods/service/GoodsService.java

@@ -6,6 +6,7 @@ import com.sqx.common.utils.Result;
 import com.sqx.modules.goods.dto.ShopQueryDTO;
 import com.sqx.modules.goods.entity.Goods;
 import com.sqx.modules.goods.entity.GoodsAttr;
+import com.sqx.modules.goods.entity.GoodsShop;
 
 import java.util.List;
 
@@ -64,4 +65,8 @@ public interface GoodsService extends IService<Goods> {
     List<Long> getByAllGoodsIdByShopId(Long shopId);
 
     Result selectSupplierShop(ShopQueryDTO queryDTO);
+
+    Result selectGoodShop(Long shopId);
+
+    Result updateGoodShop(GoodsShop goodsShop);
 }

+ 25 - 0
src/main/java/com/sqx/modules/goods/service/impl/GoodsServiceImpl.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sqx.common.exception.SqxException;
@@ -811,4 +812,28 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
         return Result.success().put("data", pageUtils);
     }
 
+    @Override
+    public Result selectGoodShop(Long shopId) {
+        GoodsShop goodsShop = goodsShopDao.selectById(shopId);
+
+        return Result.success().put("data",goodsShop);
+    }
+
+    @Override
+    public Result updateGoodShop(GoodsShop goodsShop) {
+        Long shopId = goodsShop.getShopId();
+        Integer messageConfiguration = goodsShop.getMessageConfiguration();
+
+        GoodsShop goodsShop1 = goodsShopDao.selectById(shopId);
+        if (ObjectUtils.isEmpty(goodsShop1)) {
+            return Result.error("不存在该店铺");
+        }
+
+        goodsShop1.setMessageConfiguration(messageConfiguration);
+
+        goodsShopDao.updateById(goodsShop1);
+
+        return Result.success();
+    }
+
 }