huliguo
2025-04-21 17abf0608f62cdd318dba3e7b12a32ea486cb482
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
@@ -8,9 +8,11 @@
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsShop;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.GoodsShopService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.ShopGoodsList;
import com.ruoyi.other.vo.ShopGoodsListVo;
import io.swagger.annotations.ApiOperation;
@@ -33,6 +35,10 @@
   @Resource
   private GoodsShopService goodsShopService;
   @Resource
   private ShopService shopService;
   @Resource
   private GoodsService goodsService;
@@ -40,14 +46,20 @@
   
   /**
    * 获取商品门店关系数据
    * @param goodsShop
    * @return
    */
   @ResponseBody
   @PostMapping("/getGoodsShop")
   public R<GoodsShop> getGoodsShop(@RequestBody GoodsShop goodsShop){
      GoodsShop one = goodsShopService.getOne(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getGoodsId, goodsShop.getGoodsId())
            .eq(GoodsShop::getShopId, goodsShop.getShopId()));
   @GetMapping("/getGoodsShop/{goodsId}")
   public R<GoodsShop> getGoodsShop(@PathVariable("goodsId") Integer goodsId) {
      GoodsShop one = goodsShopService.getOne(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getGoodsId,goodsId));
      Shop shop = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getId, one.getShopId()));
      if (shop == null || shop.getStatus() ==2 || shop.getDelFlag()==1) {
         return R.ok();
      }
      one.setShopName(shop.getName());
      one.setPhone(shop.getPhone());
      one.setAddress(shop.getAddress());
      return R.ok(one);
   }