|
|
@@ -16,6 +16,7 @@ import com.izouma.nineth.repo.ShowroomRepo;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import com.izouma.nineth.utils.ObjUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -117,6 +118,7 @@ public class ShowroomService {
|
|
|
.stream()
|
|
|
.collect(Collectors.toMap(Collection::getId, coll -> coll));
|
|
|
|
|
|
+
|
|
|
room.getCollections().forEach(coll -> {
|
|
|
if (coll.getId() != null) {
|
|
|
ShowCollection showCollection = showCollectionMap.get(coll.getId());
|
|
|
@@ -124,7 +126,7 @@ public class ShowroomService {
|
|
|
showCollectionRepo.save(showCollection);
|
|
|
} else {
|
|
|
Collection collection = collectionMap.get(coll.getCollectionId());
|
|
|
- if (ObjectUtils.isNotEmpty(collection)){
|
|
|
+ if (ObjectUtils.isNotEmpty(collection)) {
|
|
|
coll.setPic(collection.getPic().get(0).getUrl());
|
|
|
coll.setShowroomId(room.getId());
|
|
|
coll.setAssetId(collection.getAssetId());
|
|
|
@@ -132,6 +134,12 @@ public class ShowroomService {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ showCollectionRepo.softDeleteByRoom(room.getId());
|
|
|
}
|
|
|
+
|
|
|
+ ObjUtils.merge(room, showroom);
|
|
|
+ showroomRepo.save(room);
|
|
|
}
|
|
|
+
|
|
|
}
|