|
@@ -13,9 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -67,10 +65,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
collectionArticle.setUpdateBy(SecurityUtils.getUserId());
|
|
|
communityCollectionArticleMapper.update(collectionArticle, new UpdateWrapper<CommunityCollectionArticle>()
|
|
|
.eq("collection_id", collectionId)
|
|
|
- .eq("article_id", articleId)
|
|
|
- .ne("is_delete", true)
|
|
|
- .or()
|
|
|
- .isNull("is_delete"));
|
|
|
+ .eq("article_id", articleId).and((wrapper) -> {
|
|
|
+ wrapper.ne("is_delete", true)
|
|
|
+ .or()
|
|
|
+ .isNull("is_delete");
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -85,9 +84,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
.selectObjs(new QueryWrapper<CommunityCollectionArticle>()
|
|
|
.select("article_id")
|
|
|
.eq("collection_id", collectionId)
|
|
|
- .ne("is_delete", true)
|
|
|
- .or()
|
|
|
- .isNull("is_delete"));
|
|
|
+ .and((wrapper) -> {
|
|
|
+ wrapper.ne("is_delete", true)
|
|
|
+ .or()
|
|
|
+ .isNull("is_delete");
|
|
|
+ }));
|
|
|
|
|
|
if (articleIdsObj.isEmpty()) {
|
|
|
return null;
|
|
@@ -138,9 +139,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
//1.更新合集状态
|
|
|
CommunityCollection collection = communityCollectionMapper.selectOne(new QueryWrapper<CommunityCollection>()
|
|
|
.eq("id", collectionId)
|
|
|
- .ne("is_delete", true)
|
|
|
- .or()
|
|
|
- .isNull("is_delete"));
|
|
|
+ .and((wrapper) -> {
|
|
|
+ wrapper.ne("is_delete", true)
|
|
|
+ .or()
|
|
|
+ .isNull("is_delete");
|
|
|
+ }));
|
|
|
collection.setDelete(true);
|
|
|
collection.setUpdateBy(SecurityUtils.getLoginUser().getUserId());
|
|
|
collection.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
@@ -148,9 +151,11 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
//2.更新合集关联的文章状态
|
|
|
List<Long> ids = communityCollectionArticleMapper.selectObjs(new QueryWrapper<CommunityCollectionArticle>()
|
|
|
.eq("collection_id", collectionId)
|
|
|
- .ne("is_delete", true)
|
|
|
- .or()
|
|
|
- .isNull("is_delete")).stream().map(item -> (Long) item).collect(Collectors.toList());
|
|
|
+ .and((wrapper) -> {
|
|
|
+ wrapper .ne("is_delete", true)
|
|
|
+ .or()
|
|
|
+ .isNull("is_delete");
|
|
|
+ })).stream().map(item -> (Long) item).collect(Collectors.toList());
|
|
|
CommunityCollectionArticle collectionArticle = new CommunityCollectionArticle();
|
|
|
collectionArticle.setDelete(true);
|
|
|
collectionArticle.setUpdateBy(SecurityUtils.getLoginUser().getUserId());
|