店铺信息修改

This commit is contained in:
张松 2025-03-01 16:29:17 +08:00
parent 3db724435c
commit e1581a60b4
3 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import com.czg.account.service.ShopInfoService;
import com.czg.annotation.SaAdminCheckPermission; import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaAdminCheckRole; import com.czg.annotation.SaAdminCheckRole;
import com.czg.resp.CzgResult; import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -42,10 +43,13 @@ public class ShopInfoController {
* 店铺详情 * 店铺详情
* 权限标识: shopInfo:detail * 权限标识: shopInfo:detail
*/ */
@SaAdminCheckPermission("shopInfo:detail") // @SaAdminCheckPermission("shopInfo:detail")
@GetMapping("/detail") @GetMapping("/detail")
public CzgResult<ShopDetailDTO> detail(Integer id) { public CzgResult<ShopDetailDTO> detail(Long id) {
return CzgResult.success(shopInfoService.detail(id)); if (StpKit.USER.isAdmin() || StpKit.USER.getShopId().equals(id)) {
return CzgResult.success(shopInfoService.detail(id));
}
return CzgResult.failure("店铺信息不存在");
} }
/** /**

View File

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

View File

@ -131,7 +131,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
} }
@Override @Override
public ShopDetailDTO detail(Integer id) { public ShopDetailDTO detail(Long id) {
ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id == null ? StpKit.USER.getShopId() : id).one(); ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id == null ? StpKit.USER.getShopId() : id).one();
if (shopInfo == null) { if (shopInfo == null) {
throw new ApiNotPrintException("店铺信息不存在"); throw new ApiNotPrintException("店铺信息不存在");