jiangqs
2023-05-10 7a49bcc5e561df7a9b65266a57a9c0896c0fd3d0
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java
@@ -1,17 +1,19 @@
package com.ruoyi.shop.controller.console;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.shop.domain.pojo.shop.ShopRelUser;
import com.ruoyi.shop.service.shop.ShopRelUserService;
import com.ruoyi.shop.service.shop.ShopService;
import com.ruoyi.system.api.domain.poji.activity.ActivityGoods;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.vo.ShopRelUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Optional;
/**
 * @author jqs34
@@ -27,6 +29,9 @@
    @Resource
    private ShopService shopService;
    @Resource
    private ShopRelUserService shopRelUserService;
    @PostMapping("/getShop")
    public R<Shop> getShop(@RequestBody Long shopId)
@@ -36,4 +41,16 @@
    }
    @GetMapping("/getShopByUserId")
    public R<ShopRelUserVo> getShopByUserId(Long userId)
    {
        ShopRelUser shopRelUser = shopRelUserService.getByUserId(userId);
        Optional.ofNullable(shopRelUser).orElseThrow(() -> new ServiceException("未查询到商户信息"));
        ShopRelUserVo shopRelUserVo = new ShopRelUserVo();
        shopRelUserVo.setShopId(shopRelUser.getShopId());
        shopRelUserVo.setUserName(shopRelUser.getUserName());
        return R.ok(shopRelUserVo);
    }
}