feat: 详情页加收藏标识
This commit is contained in:
+35
-3
@@ -457,6 +457,36 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
* @Date: 2023/9/11 14:49
|
||||
* @Description: 是否收藏标识判断
|
||||
**/
|
||||
private void collectionFlag(Map<String, Object> stringObjectMap) {
|
||||
// 获取全部id集合
|
||||
String id = String.valueOf(stringObjectMap.get("id"));
|
||||
if (StrUtil.isBlank(id)) return;
|
||||
// 获取登录用户
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// 查询标准收藏表
|
||||
LambdaQueryWrapper<LawsStandardCollection> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(LawsStandardCollection::getCollectorId, loginUser.getId());
|
||||
queryWrapper.eq(LawsStandardCollection::getStandardId, id);
|
||||
List<LawsStandardCollection> standardCollectionList = lawsStandardCollectionService.list(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(standardCollectionList)) {
|
||||
stringObjectMap.put(FieldCommon.COLLECTION_FLAG, false);
|
||||
return;
|
||||
}
|
||||
List<String> standardIdList = standardCollectionList.stream()
|
||||
.map(LawsStandardCollection::getStandardId).collect(Collectors.toList());
|
||||
if (standardIdList.contains(id)) {
|
||||
stringObjectMap.put(FieldCommon.COLLECTION_FLAG, true);
|
||||
} else {
|
||||
stringObjectMap.put(FieldCommon.COLLECTION_FLAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/9/11 14:49
|
||||
* @Description: 标准详情是否收藏标识
|
||||
**/
|
||||
private void collectionFlag(List<Map<String, Object>> records) {
|
||||
// 获取全部id集合
|
||||
List<String> ids = records.stream().map(kv ->
|
||||
@@ -1225,6 +1255,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
splitFlag(stringObjectMap);
|
||||
// 添加固定字段
|
||||
this.setFixedUserInfo(stringObjectMap, singleStandard);
|
||||
// 标准收藏标识
|
||||
collectionFlag(stringObjectMap);
|
||||
// 对返回的字段做处理
|
||||
return stringObjectMap;
|
||||
}
|
||||
@@ -1293,16 +1325,16 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
List<String> nodeCode = lawsTreeNodeList.stream()
|
||||
.map(LawsTreeNode::getNodeCode).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<LawsNodeRelation> query = new LambdaQueryWrapper<>();
|
||||
query.and(o->{
|
||||
query.and(o -> {
|
||||
for (int i = 0; i < nodeCode.size(); i++) {
|
||||
o.likeRight(LawsNodeRelation::getNodeCode, nodeCode.get(i));
|
||||
if(i != (nodeCode.size() - 1)){
|
||||
if (i != (nodeCode.size() - 1)) {
|
||||
o.or();
|
||||
}
|
||||
}
|
||||
});
|
||||
List<LawsNodeRelation> lawsNodeRelationListAll = lawsNodeRelationService.list(query);
|
||||
if(!CollectionUtils.isEmpty(lawsNodeRelationListAll)){
|
||||
if (!CollectionUtils.isEmpty(lawsNodeRelationListAll)) {
|
||||
String ids = lawsNodeRelationListAll.stream().map(LawsNodeRelation::getUniqueRelationFlag)
|
||||
.collect(Collectors.joining(","));
|
||||
selectionBoxVO.setIds(ids);
|
||||
|
||||
Reference in New Issue
Block a user