From 75485f988a6783082ea1a948f170f47ba46cd991 Mon Sep 17 00:00:00 2001 From: daheeParkk Date: Sun, 3 Mar 2024 22:15:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=EC=82=AD=EC=A0=9C=EB=90=9C=20?= =?UTF-8?q?=EC=83=81=EC=A0=90=EC=97=90=EC=84=9C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../koreatech/in/repository/admin/AdminShopMapper.java | 2 ++ .../koreatech/in/service/admin/AdminShopServiceImpl.java | 7 ++++++- src/main/resources/mapper/admin/AdminShopMapper.xml | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/koreatech/in/repository/admin/AdminShopMapper.java b/src/main/java/koreatech/in/repository/admin/AdminShopMapper.java index ca428b62..45bc917e 100644 --- a/src/main/java/koreatech/in/repository/admin/AdminShopMapper.java +++ b/src/main/java/koreatech/in/repository/admin/AdminShopMapper.java @@ -70,6 +70,8 @@ public interface AdminShopMapper { Shop getShopById(@Param("id") Integer id); + Shop getDeletedShopById(@Param("id") Integer id); + ShopMenuCategory getMenuCategoryByShopIdAndName(@Param("shopId") Integer shopId, @Param("name") String name); Integer getCountOfMenuCategoriesByShopId(@Param("shopId") Integer shopId); diff --git a/src/main/java/koreatech/in/service/admin/AdminShopServiceImpl.java b/src/main/java/koreatech/in/service/admin/AdminShopServiceImpl.java index 265e3bed..2d29f0d2 100644 --- a/src/main/java/koreatech/in/service/admin/AdminShopServiceImpl.java +++ b/src/main/java/koreatech/in/service/admin/AdminShopServiceImpl.java @@ -320,7 +320,7 @@ public void deleteShop(Integer shopId) { @Override public void undeleteOfShop(Integer shopId) { - Shop shop = getShopById(shopId); + Shop shop = getDeletedShopById(shopId); if (!shop.isDeleted()) { throw new BaseException(SHOP_NOT_DELETED); @@ -627,6 +627,11 @@ private Shop getShopById(Integer id) { .orElseThrow(() -> new BaseException(SHOP_NOT_FOUND)); } + private Shop getDeletedShopById(Integer id) { + return Optional.ofNullable(adminShopMapper.getDeletedShopById(id)) + .orElseThrow(() -> new BaseException(SHOP_NOT_FOUND)); + } + private ShopMenu getMenuByIdAndShopId(Integer menuId, Integer shopId) { ShopMenu menu = Optional.ofNullable(adminShopMapper.getMenuById(menuId)) .orElseThrow(() -> new BaseException(SHOP_MENU_NOT_FOUND)); diff --git a/src/main/resources/mapper/admin/AdminShopMapper.xml b/src/main/resources/mapper/admin/AdminShopMapper.xml index 690540e1..dad0eece 100644 --- a/src/main/resources/mapper/admin/AdminShopMapper.xml +++ b/src/main/resources/mapper/admin/AdminShopMapper.xml @@ -529,6 +529,14 @@ AND `is_deleted` = 0 + + - -