From 808064f32d96106df0a8de0f75eb627c4402e195 Mon Sep 17 00:00:00 2001 From: ktykty0722 Date: Wed, 22 Feb 2023 18:20:06 +0900 Subject: [PATCH] =?UTF-8?q?feat(BE)=20:=20=EA=B8=B0=ED=94=84=ED=8B=B0?= =?UTF-8?q?=EC=BD=98=20=EC=82=AD=EC=A0=9C=EB=A5=BC=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EB=8B=A4?= =?UTF-8?q?=EB=A5=B8=20=EA=B8=B0=ED=94=84=ED=8B=B0=EC=BD=98=20select=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=EC=97=90=20=EC=82=AD=EC=A0=9C=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20=ED=8C=90=EB=B3=84=20=EC=B6=94=EA=B0=80(#190)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gifticon/repository/GifticonRepository.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java index 973e44d..56a8211 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java @@ -29,7 +29,7 @@ public interface GifticonRepository extends CrudRepository { "barcode, " + "expiresAt, " + "usedAt, " + - "price FROM gifticon WHERE id = :id") + "price FROM gifticon WHERE id = :id AND deleted = 0") Optional findById(@Param("id") long id); @Modifying @@ -58,7 +58,7 @@ void addGifticon( "expiresAt, " + "usedAt, " + "price FROM gifticon WHERE uid = :uid AND (usedAt >= (select now())) AND " + - "(itemName LIKE concat('%', :keyword, '%') OR brandName LIKE concat('%', :keyword, '%'))") + "(itemName LIKE concat('%', :keyword, '%') OR brandName LIKE concat('%', :keyword, '%')) AND deleted = 0") List findByUid(@Param("uid") long uid, @Param("keyword") String keyword); @Modifying @@ -78,6 +78,10 @@ void addGifticon( "barcode, " + "expiresAt, " + "usedAt, " + - "price FROM gifticon WHERE uid = :uid AND usedAt <= (select now())") + "price FROM gifticon WHERE uid = :uid AND usedAt <= (select now()) AND deleted = 0") List findUsedByUid(@Param("uid") long uid); + + @Modifying + @Query("UPDATE gifticon SET deleted = 1 WHERE id = :id") + void deleteGifticon(@Param("id") long id); }