|
@@ -1,10 +1,13 @@
|
|
|
package com.xjrsoft.module.oa.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
+import com.xjrsoft.module.authority.entity.DataAuthConfig;
|
|
|
import com.xjrsoft.module.oa.dto.AddNewsAppendixDto;
|
|
|
import com.xjrsoft.module.oa.dto.AddNewsDto;
|
|
|
import com.xjrsoft.module.oa.dto.AddNewsRelationDto;
|
|
|
+import com.xjrsoft.module.oa.dto.UpdateNewsDto;
|
|
|
import com.xjrsoft.module.oa.entity.News;
|
|
|
import com.xjrsoft.module.oa.entity.NewsAppendix;
|
|
|
import com.xjrsoft.module.oa.entity.NewsRelation;
|
|
@@ -66,6 +69,36 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean update(UpdateNewsDto updateNewsDto) {
|
|
|
+ News news = BeanUtil.toBean(updateNewsDto, News.class);
|
|
|
+ newsMapper.insert(news);
|
|
|
+
|
|
|
+
|
|
|
+ newsAppendixMapper.delete(Wrappers.lambdaQuery(NewsAppendix.class).eq(NewsAppendix::getNewsId,news.getId()));
|
|
|
+ for (AddNewsAppendixDto appendixDto : updateNewsDto.getAppendixList()) {
|
|
|
+ NewsAppendix newsAppendix =BeanUtil.toBean(appendixDto, NewsAppendix.class);
|
|
|
+ newsAppendix.setNewsId(news.getId());
|
|
|
+ newsAppendixMapper.insert(newsAppendix);
|
|
|
+ }
|
|
|
+
|
|
|
+ newsRelationMapper.delete(Wrappers.lambdaQuery(NewsRelation.class).eq(NewsRelation::getNewsId,news.getId()));
|
|
|
+ for (AddNewsRelationDto relationDto : updateNewsDto.getRelationList()) {
|
|
|
+ NewsRelation newsRelation = new NewsRelation();
|
|
|
+ newsRelation.setNewsId(news.getId());
|
|
|
+ newsRelation.setReadMark(0);
|
|
|
+ if (relationDto.getRelationType() == 1) {
|
|
|
+ // 获取部门下的人员添加
|
|
|
+ } else {
|
|
|
+ newsRelation.setUserId(relationDto.getRelationId());
|
|
|
+ newsRelationMapper.insert(newsRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean delete(List<Long> ids) {
|