|
@@ -85,8 +85,8 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
* @return 文章信息
|
|
* @return 文章信息
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public JSONArray selectArticleInfoInCollection(Long collectionId,Long searchType) {
|
|
|
|
- if (searchType == null){
|
|
|
|
|
|
+ public JSONArray selectArticleInfoInCollection(Long collectionId, Long searchType) {
|
|
|
|
+ if (searchType == null) {
|
|
searchType = 1L;
|
|
searchType = 1L;
|
|
}
|
|
}
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
@@ -99,7 +99,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
}));
|
|
}));
|
|
|
|
|
|
- if (communityCollection == null){
|
|
|
|
|
|
+ if (communityCollection == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
//没调用这一个接口 热度 + 1
|
|
//没调用这一个接口 热度 + 1
|
|
@@ -111,21 +111,21 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
|
|
|
//一级层级
|
|
//一级层级
|
|
JSONObject collectionObject = new JSONObject();
|
|
JSONObject collectionObject = new JSONObject();
|
|
- collectionObject.put("CollectionName",communityCollection.getCollectionName());
|
|
|
|
|
|
+ collectionObject.put("CollectionName", communityCollection.getCollectionName());
|
|
Date updateTime = communityCollection.getUpdateTime();
|
|
Date updateTime = communityCollection.getUpdateTime();
|
|
- if (updateTime == null){
|
|
|
|
|
|
+ if (updateTime == null) {
|
|
updateTime = communityCollection.getCreateTime();
|
|
updateTime = communityCollection.getCreateTime();
|
|
}
|
|
}
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
String formattedUpdateTime = sdf.format(updateTime);
|
|
String formattedUpdateTime = sdf.format(updateTime);
|
|
- collectionObject.put("collectioncreateby",communityCollection.getCreateBy());
|
|
|
|
- collectionObject.put("updateTime",formattedUpdateTime);
|
|
|
|
- collectionObject.put("followNumber", communityCollectionUserMapper.selectList(new QueryWrapper<CommunityCollectionUser>().eq("collection_id",collectionId).and((wrapper) -> {
|
|
|
|
|
|
+ collectionObject.put("collectioncreateby", communityCollection.getCreateBy());
|
|
|
|
+ collectionObject.put("updateTime", formattedUpdateTime);
|
|
|
|
+ collectionObject.put("followNumber", communityCollectionUserMapper.selectList(new QueryWrapper<CommunityCollectionUser>().eq("collection_id", collectionId).and((wrapper) -> {
|
|
wrapper.ne("is_delete", true)
|
|
wrapper.ne("is_delete", true)
|
|
.or()
|
|
.or()
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
})).size());
|
|
})).size());
|
|
- collectionObject.put("heat",communityCollection.getHeat());
|
|
|
|
|
|
+ collectionObject.put("heat", communityCollection.getHeat());
|
|
|
|
|
|
//查询当前用户是否订阅
|
|
//查询当前用户是否订阅
|
|
CommunityCollectionUser communityCollectionUser = communityCollectionUserMapper.selectOne(new QueryWrapper<CommunityCollectionUser>()
|
|
CommunityCollectionUser communityCollectionUser = communityCollectionUserMapper.selectOne(new QueryWrapper<CommunityCollectionUser>()
|
|
@@ -137,10 +137,10 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
}));
|
|
}));
|
|
boolean follow = false;
|
|
boolean follow = false;
|
|
- if (communityCollectionUser != null){
|
|
|
|
|
|
+ if (communityCollectionUser != null) {
|
|
follow = true;
|
|
follow = true;
|
|
}
|
|
}
|
|
- collectionObject.put("follow",follow);
|
|
|
|
|
|
+ collectionObject.put("follow", follow);
|
|
|
|
|
|
//查询合集关联文章表
|
|
//查询合集关联文章表
|
|
List<Object> articleIdsObj = collectionArticleMapper
|
|
List<Object> articleIdsObj = collectionArticleMapper
|
|
@@ -156,8 +156,6 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
if (articleIdsObj.isEmpty()) {
|
|
if (articleIdsObj.isEmpty()) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- collectionObject.put("articleNumber", articleIdsObj.size());
|
|
|
|
-
|
|
|
|
|
|
|
|
//转换object为long
|
|
//转换object为long
|
|
List<Long> articleIds = articleIdsObj.stream()
|
|
List<Long> articleIds = articleIdsObj.stream()
|
|
@@ -176,7 +174,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
.or()
|
|
.or()
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
}).orderByDesc("create_time"));
|
|
}).orderByDesc("create_time"));
|
|
- } else{
|
|
|
|
|
|
+ } else {
|
|
// 查询最早的文章
|
|
// 查询最早的文章
|
|
communityArticles = communityArticleMapper.selectList(
|
|
communityArticles = communityArticleMapper.selectList(
|
|
new QueryWrapper<CommunityArticle>().in("id", articleIds).and((wrapper) -> {
|
|
new QueryWrapper<CommunityArticle>().in("id", articleIds).and((wrapper) -> {
|
|
@@ -185,9 +183,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
}).orderByAsc("create_time"));
|
|
}).orderByAsc("create_time"));
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ collectionObject.put("articleNumber", communityArticles.size());
|
|
|
|
|
|
List<CommunityCollectionArticleVo> collectionArticleVos = new ArrayList<>();
|
|
List<CommunityCollectionArticleVo> collectionArticleVos = new ArrayList<>();
|
|
CommunityCollectionArticleVo collectionArticleVo = null;
|
|
CommunityCollectionArticleVo collectionArticleVo = null;
|
|
@@ -219,7 +215,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
|
|
|
|
collectionArticleVos.add(collectionArticleVo);
|
|
collectionArticleVos.add(collectionArticleVo);
|
|
}
|
|
}
|
|
- collectionObject.put("Article",collectionArticleVos);
|
|
|
|
|
|
+ collectionObject.put("Article", collectionArticleVos);
|
|
jsonArray.add(collectionObject);
|
|
jsonArray.add(collectionObject);
|
|
|
|
|
|
return jsonArray;
|
|
return jsonArray;
|
|
@@ -248,7 +244,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
List<Long> ids = communityCollectionArticleMapper.selectObjs(new QueryWrapper<CommunityCollectionArticle>()
|
|
List<Long> ids = communityCollectionArticleMapper.selectObjs(new QueryWrapper<CommunityCollectionArticle>()
|
|
.eq("collection_id", collectionId)
|
|
.eq("collection_id", collectionId)
|
|
.and((wrapper) -> {
|
|
.and((wrapper) -> {
|
|
- wrapper .ne("is_delete", true)
|
|
|
|
|
|
+ wrapper.ne("is_delete", true)
|
|
.or()
|
|
.or()
|
|
.isNull("is_delete");
|
|
.isNull("is_delete");
|
|
})).stream().map(item -> (Long) item).collect(Collectors.toList());
|
|
})).stream().map(item -> (Long) item).collect(Collectors.toList());
|
|
@@ -260,8 +256,8 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<CommunityCollectionVo> selectUserCollection(Long userId,Long articleId) {
|
|
|
|
- return communityCollectionMapper.selectUserCollection(userId,articleId);
|
|
|
|
|
|
+ public List<CommunityCollectionVo> selectUserCollection(Long userId, Long articleId) {
|
|
|
|
+ return communityCollectionMapper.selectUserCollection(userId, articleId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|