licailing 3 năm trước cách đây
mục cha
commit
c70a0fa6cd

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

@@ -28,7 +28,7 @@ public interface ShowCollectionRepo extends JpaRepository<ShowCollection, Long>,
     @Transactional
     void softDeleteByRoom(Long showroomId);
 
-    @Query("update ShowCollection t set t.del = true where t.showroomId = ?1")
+    @Query("update ShowCollection t set t.del = true where t.showroomId in ?1")
     @Modifying
     @Transactional
     void softDeleteByIdIn(Collection<Long> ids);

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

@@ -127,10 +127,12 @@ public class ShowroomService {
             showCollections.forEach(coll -> {
                 if (coll.getId() != null) {
                     ShowCollection showCollection = showCollectionMap.get(coll.getId());
-                    ObjUtils.merge(showCollection, coll);
-                    showCollectionRepo.save(showCollection);
-                    // 移除掉
-                    removeRecord.remove(coll.getId());
+                    if (ObjectUtils.isNotEmpty(showCollection)) {
+                        ObjUtils.merge(showCollection, coll);
+                        showCollectionRepo.save(showCollection);
+                        // 移除掉
+                        removeRecord.remove(coll.getId());
+                    }
                 } else {
                     Collection collection = collectionMap.get(coll.getCollectionId());
                     if (ObjectUtils.isNotEmpty(collection)) {

+ 5 - 0
src/test/java/com/izouma/nineth/service/AssetServiceTest.java

@@ -242,4 +242,9 @@ class AssetServiceTest extends ApplicationTests {
     public void transferCDN() throws ExecutionException, InterruptedException {
         assetService.transferCDN();
     }
+
+    @Test
+    public void cancelPublicShow(){
+        assetService.cancelPublic(202159L);
+    }
 }

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

@@ -92,6 +92,7 @@ public class ShowroomServiceTest extends ApplicationTests {
         ShowCollection collection2 = ShowCollection.builder()
                 .sort(1)
                 .collectionId(207014L)
+                .showroomId(207035L)
                 .build();
         collection2.setId(207038L);
 
@@ -166,7 +167,7 @@ public class ShowroomServiceTest extends ApplicationTests {
                 .introduction("这个一个展厅测试")
                 .build();
         showroom.setId(207035L);
-        showroomService.save(9972L, showroom);
+        showroomService.update(showroom);
 
     }
 }