店铺详情修改

This commit is contained in:
张松
2025-02-15 11:16:18 +08:00
parent 006e223c71
commit ec0809a783
3 changed files with 15 additions and 5 deletions

View File

@@ -26,6 +26,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Objects;
/**
* @author Administrator
*/
@@ -118,8 +120,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
}
@Override
public ShopInfo detail() {
return queryChain().eq(ShopInfo::getId, StpKit.USER.getLoginIdAsLong()).one();
public ShopInfo detail(Integer id) {
ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id).one();
if (shopInfo == null) {
throw new ApiNotPrintException("店铺信息不存在");
}
if (!StpKit.USER.isAdmin() && !Objects.equals(StpKit.USER.getShopId(), shopInfo.getId())) {
throw new ApiNotPrintException("店铺信息不存在");
}
return shopInfo;
}
@Override