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.*;
|
|
import javax.annotation.Resource;
|
import java.util.Optional;
|
|
/**
|
* @author jqs34
|
* @ClassName ShopController
|
* @description: TODO
|
* @date 2023年05月03日
|
* @version: 1.0
|
*/
|
@RestController
|
@RequestMapping("/shop")
|
public class ShopController {
|
|
@Resource
|
private ShopService shopService;
|
|
@Resource
|
private ShopRelUserService shopRelUserService;
|
|
|
@PostMapping("/getShop")
|
public R<Shop> getShop(@RequestBody Long shopId)
|
{
|
Shop shop = shopService.getByShopId(shopId);
|
return R.ok(shop);
|
}
|
|
|
@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);
|
}
|
|
|
}
|