|
@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
@@ -14,14 +15,6 @@ import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.oa.dto.*;
|
|
|
-import com.xjrsoft.module.oa.dto.AddNewsDto;
|
|
|
-import com.xjrsoft.module.oa.dto.ChangeNewsDto;
|
|
|
-import com.xjrsoft.module.oa.dto.DeleteNewsRelationDto;
|
|
|
-import com.xjrsoft.module.oa.dto.NewsPageDto;
|
|
|
-import com.xjrsoft.module.oa.dto.NewsRelationPageDto;
|
|
|
-import com.xjrsoft.module.oa.dto.NewsReplyDto;
|
|
|
-import com.xjrsoft.module.oa.dto.UpdateNewsDto;
|
|
|
-import com.xjrsoft.module.oa.dto.UpdateNewsRelationDto;
|
|
|
import com.xjrsoft.module.oa.entity.News;
|
|
|
import com.xjrsoft.module.oa.entity.NewsAppendix;
|
|
|
import com.xjrsoft.module.oa.entity.NewsRelation;
|
|
@@ -106,6 +99,35 @@ public class NewsController {
|
|
|
if (news == null) {
|
|
|
RT.error("找不到此新闻!");
|
|
|
}
|
|
|
+
|
|
|
+ LambdaQueryWrapper<NewsRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .eq(NewsRelation::getNewsId , id)
|
|
|
+ .select(NewsRelation.class, x -> VoToColumnUtil.fieldsToColumns(NewsRelation.class).contains(x.getProperty()));
|
|
|
+
|
|
|
+ List<NewsRelationVo> newsRelationVoList = new ArrayList<>();
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotNull(news.getCreateUserId()) && StpUtil.getLoginIdAsLong() == news.getCreateUserId()){
|
|
|
+
|
|
|
+ List<NewsRelation> newsRelationList = newsRelationService.list(queryWrapper);
|
|
|
+
|
|
|
+ newsRelationList.stream().forEach(element -> {
|
|
|
+ // 对元素进行操作
|
|
|
+ NewsRelationVo newsRelationVo = BeanUtil.toBean(element, NewsRelationVo.class);
|
|
|
+ newsRelationVoList.add(newsRelationVo);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ queryWrapper.eq(NewsRelation::getUserId , StpUtil.getLoginIdAsLong());
|
|
|
+ NewsRelation newsRelation = newsRelationService.getOne(queryWrapper);
|
|
|
+ NewsRelationVo newsRelationVo = BeanUtil.toBean(newsRelation, NewsRelationVo.class);
|
|
|
+ newsRelationVoList.add(newsRelationVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ NewsVo newsVo = BeanUtil.toBean(news, NewsVo.class);
|
|
|
+ newsVo.setRelationList(newsRelationVoList);
|
|
|
+
|
|
|
if (BooleanUtils.isTrue(isRead)) {
|
|
|
// NewsRelation newsRelation = new NewsRelation();
|
|
|
// newsRelation.setNewsId(id);
|
|
@@ -116,7 +138,7 @@ public class NewsController {
|
|
|
// newsRelationService.save(newsRelation);
|
|
|
}
|
|
|
|
|
|
- NewsVo newsVo = BeanUtil.toBean(news, NewsVo.class);
|
|
|
+
|
|
|
|
|
|
// List<NewsRelationVo> newsRelationVoList = newsRelationService.selectJoinList(NewsRelationVo.class,
|
|
|
// new MPJLambdaWrapper<NewsRelation>()
|