店铺详情修改

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") @SaAdminCheckPermission("shopInfo:detail")
@GetMapping("/detail") @GetMapping("/detail")
public CzgResult<ShopInfo> detail() { public CzgResult<ShopInfo> detail(Integer id) {
return CzgResult.success(shopInfoService.detail()); return CzgResult.success(shopInfoService.detail(id));
} }
/** /**

View File

@ -18,7 +18,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
Boolean edit(ShopInfoEditDTO shopInfoEditDTO); Boolean edit(ShopInfoEditDTO shopInfoEditDTO);
ShopInfo detail(); ShopInfo detail(Integer id);
ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState); 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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.Objects;
/** /**
* @author Administrator * @author Administrator
*/ */
@ -118,8 +120,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
} }
@Override @Override
public ShopInfo detail() { public ShopInfo detail(Integer id) {
return queryChain().eq(ShopInfo::getId, StpKit.USER.getLoginIdAsLong()).one(); 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 @Override