licailing преди 3 години
родител
ревизия
4fbbecb474

+ 6 - 0
src/main/java/com/izouma/nineth/repo/ShowCollectionRepo.java

@@ -22,6 +22,8 @@ public interface ShowCollectionRepo extends JpaRepository<ShowCollection, Long>,
     @Transactional
     void softDeleteCollection(Long collectionId);
 
+    @Transactional
+    @Modifying
     void deleteAllByCollectionId(@NotNull Long collectionId);
 
     List<ShowCollection> findAllByShowroomId(Long showroomId);
@@ -33,6 +35,8 @@ public interface ShowCollectionRepo extends JpaRepository<ShowCollection, Long>,
     @Transactional
     void softDeleteByRoom(Long showroomId);
 
+    @Transactional
+    @Modifying
     void deleteAllByShowroomId(@NotNull Long showroomId);
 
     @Query("update ShowCollection t set t.del = true where t.id in ?1")
@@ -40,6 +44,8 @@ public interface ShowCollectionRepo extends JpaRepository<ShowCollection, Long>,
     @Transactional
     void softDeleteByIdIn(Collection<Long> ids);
 
+    @Transactional
+    @Modifying
     void deleteAllByIdIn(Collection<Long> ids);
 
 }

+ 1 - 1
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -282,7 +282,7 @@ public class AssetService {
                 .orElseThrow(new BusinessException("无展示记录"));
         collectionRepo.delete(collection);
         // 如果展厅有此藏品
-        showCollectionRepo.softDeleteCollection(asset.getPublicCollectionId());
+        showCollectionRepo.deleteAllByCollectionId(asset.getPublicCollectionId());
 
         asset.setPublicShow(false);
         asset.setPublicCollectionId(null);

+ 1 - 1
src/main/java/com/izouma/nineth/service/MintOrderService.java

@@ -255,7 +255,7 @@ public class MintOrderService {
                                 .orElseThrow(new BusinessException("无展示记录"));
                         collectionRepo.delete(collection);
                         // 如果展厅有此藏品
-                        showCollectionRepo.softDeleteCollection(asset.getPublicCollectionId());
+                        showCollectionRepo.deleteAllByCollectionId(asset.getPublicCollectionId());
 
                         asset.setPublicShow(false);
                         asset.setPublicCollectionId(null);

+ 1 - 1
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -614,7 +614,7 @@ public class OrderService {
                         assetService.transfer(asset, order.getPrice(), user, "转让", order.getId());
                         collectionRepo.delete(collection);
                         // 如果展厅有此藏品
-                        showCollectionRepo.softDeleteCollection(order.getCollectionId());
+                        showCollectionRepo.deleteAllByCollectionId(order.getCollectionId());
 
                         // 发送短信提醒用户转让成功
                         if (asset != null && asset.getUserId() != null) {

+ 2 - 2
src/main/java/com/izouma/nineth/service/ShowroomService.java

@@ -196,10 +196,10 @@ public class ShowroomService {
             });
         } else {
             // 删掉本次没有的
-            showCollectionRepo.softDeleteByRoom(recordRoom.getId());
+            showCollectionRepo.deleteAllByShowroomId(recordRoom.getId());
         }
         if (CollUtil.isNotEmpty(removeRecord)) {
-            showCollectionRepo.softDeleteByIdIn(removeRecord);
+            showCollectionRepo.deleteAllByIdIn(removeRecord);
         }
 
         ObjUtils.merge(recordRoom, showroom);

+ 1 - 1
src/main/java/com/izouma/nineth/web/ShowroomController.java

@@ -87,7 +87,7 @@ public class ShowroomController extends BaseController {
 
     @PostMapping("/del/{id}")
     public void del(@PathVariable Long id) {
-        showCollectionRepo.softDeleteByRoom(id);
+        showCollectionRepo.deleteAllByShowroomId(id);
         showroomRepo.softDelete(id);
     }
 

+ 10 - 10
src/test/java/com/izouma/nineth/service/ShowroomServiceTest.java

@@ -149,16 +149,16 @@ public class ShowroomServiceTest extends ApplicationTests {
                 .build();
 
         List<ShowCollection> collections = new ArrayList<>();
-        collections.add(collection2);
-        collections.add(collection3);
-        collections.add(collection4);
-        collections.add(collection5);
-        collections.add(collection6);
-        collections.add(collection7);
-        collections.add(collection8);
-        collections.add(collection9);
-        collections.add(collection10);
-        collections.add(collection11);
+//        collections.add(collection2);
+//        collections.add(collection3);
+//        collections.add(collection4);
+//        collections.add(collection5);
+//        collections.add(collection6);
+//        collections.add(collection7);
+//        collections.add(collection8);
+//        collections.add(collection9);
+//        collections.add(collection10);
+//        collections.add(collection11);
 
         Showroom showroom = Showroom.builder()
                 .assetId(207029L)