|
|
@@ -17,18 +17,23 @@ import com.xjrsoft.common.model.result.R;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.authority.entity.DataAuth;
|
|
|
import com.xjrsoft.module.oa.dto.AddNewsDto;
|
|
|
import com.xjrsoft.module.oa.dto.NewsPageDto;
|
|
|
import com.xjrsoft.module.oa.dto.UpdateNewsDto;
|
|
|
import com.xjrsoft.module.oa.entity.Message;
|
|
|
import com.xjrsoft.module.oa.entity.News;
|
|
|
+import com.xjrsoft.module.oa.entity.NewsAppendix;
|
|
|
import com.xjrsoft.module.oa.entity.NewsRelation;
|
|
|
import com.xjrsoft.module.oa.service.IMessageService;
|
|
|
+import com.xjrsoft.module.oa.service.INewsAppendixService;
|
|
|
import com.xjrsoft.module.oa.service.INewsRelationService;
|
|
|
import com.xjrsoft.module.oa.service.INewsService;
|
|
|
-import com.xjrsoft.module.oa.vo.MessageVo;
|
|
|
-import com.xjrsoft.module.oa.vo.NewsPageVo;
|
|
|
-import com.xjrsoft.module.oa.vo.NewsVo;
|
|
|
+import com.xjrsoft.module.oa.vo.*;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
+import com.xjrsoft.module.system.entity.File;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -55,6 +60,7 @@ public class NewsController {
|
|
|
private INewsService newsService;
|
|
|
|
|
|
private INewsRelationService newsRelationService;
|
|
|
+ private INewsAppendixService newsAppendixService;
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
@@ -102,15 +108,37 @@ public class NewsController {
|
|
|
R.error("找不到此新闻!");
|
|
|
}
|
|
|
if (BooleanUtils.isTrue(isRead)) {
|
|
|
- NewsRelation newsRelation = new NewsRelation();
|
|
|
- newsRelation.setNewsId(id);
|
|
|
- newsRelation.setUserId(StpUtil.getLoginIdAsLong());
|
|
|
- newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
|
|
|
- .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
- .eq(NewsRelation::getNewsId, id));
|
|
|
- newsRelationService.save(newsRelation);
|
|
|
+// NewsRelation newsRelation = new NewsRelation();
|
|
|
+// newsRelation.setNewsId(id);
|
|
|
+// newsRelation.setUserId(StpUtil.getLoginIdAsLong());
|
|
|
+// newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
|
|
|
+// .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
+// .eq(NewsRelation::getNewsId, id));
|
|
|
+// newsRelationService.save(newsRelation);
|
|
|
+ }
|
|
|
+
|
|
|
+ NewsVo newsVo = BeanUtil.toBean(news, NewsVo.class);
|
|
|
+
|
|
|
+ List<NewsRelationVo> newsRelationVoList = newsRelationService.selectJoinList(NewsRelationVo.class,
|
|
|
+ new MPJLambdaWrapper<NewsRelation>()
|
|
|
+ .eq(NewsRelation::getNewsId, id)
|
|
|
+ .select(NewsRelation.class, x -> VoToColumnUtil.fieldsToColumns(NewsRelationVo.class).contains(x.getProperty()))
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, NewsRelation::getUserId, ext -> ext.selectAs(XjrUser::getName, NewsRelationVo::getUserName)));
|
|
|
+ if (newsRelationVoList.size() > 0) {
|
|
|
+ newsVo.setRelationList(newsRelationVoList);
|
|
|
}
|
|
|
- return R.ok(BeanUtil.toBean(news, NewsVo.class));
|
|
|
+
|
|
|
+ List<NewsAppendixVo> newsAppendixVoList = newsAppendixService.selectJoinList(NewsAppendixVo.class,
|
|
|
+ new MPJLambdaWrapper<NewsAppendix>().eq(NewsAppendix::getNewsId, id)
|
|
|
+ .select(NewsAppendix.class, x -> VoToColumnUtil.fieldsToColumns(NewsAppendixVo.class).contains(x.getProperty()))
|
|
|
+ .leftJoin(File.class, File::getId, NewsAppendix::getFileId, ext -> ext.selectAs(File::getFileName, NewsAppendixVo::getFileName))
|
|
|
+ );
|
|
|
+
|
|
|
+ if (newsAppendixVoList.size() > 0) {
|
|
|
+ newsVo.setAppendixList(newsAppendixVoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok(newsVo);
|
|
|
}
|
|
|
|
|
|
@PutMapping
|