店铺详情修改

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

@ -42,8 +42,8 @@ public class ShopInfoController {
*/
@SaAdminCheckPermission("shopInfo:detail")
@GetMapping("/detail")
public CzgResult<ShopInfo> detail() {
return CzgResult.success(shopInfoService.detail());
public CzgResult<ShopInfo> detail(Integer id) {
return CzgResult.success(shopInfoService.detail(id));
}
/**

View File

@ -18,7 +18,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
Boolean edit(ShopInfoEditDTO shopInfoEditDTO);
ShopInfo detail();
ShopInfo detail(Integer id);
ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState);
}

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