Browse Source

Merge remote-tracking branch 'origin/lingshan_master' into dev

master
yinzuomei 2 years ago
parent
commit
c0bd3b7549
  1. 42
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  2. 21
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

42
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1938,30 +1938,34 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
// 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){
//
LambdaQueryWrapper<ArticleContentEntity> del=new LambdaQueryWrapper<>();
del.eq(ArticleContentEntity::getArticleId,formDTO.getArticleId())
.ne(ArticleContentEntity::getContent,"rich_text");
articleContentDao.delete(del);
int orderNum=2;
for(UpdateArticleFormDTO.ContentDTO file:formDTO.getFileList()){
if(StringUtils.isNotBlank(file.getFileId())){
LambdaUpdateWrapper<ArticleContentEntity> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.set(ArticleContentEntity::getContent,file.getContent())
.set(ArticleContentEntity::getFileName,file.getFileName())
.set(ArticleContentEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId())
.set(ArticleContentEntity::getUpdatedTime,new Date())
.set(ArticleContentEntity::getOrderNum,orderNum)
.eq(ArticleContentEntity::getId,file.getFileId());
articleContentDao.update(null,updateWrapper);
}else{
ArticleContentEntity fileDto=new ArticleContentEntity();
fileDto.setCustomerId(formDTO.getCustomerId());
fileDto.setArticleId(formDTO.getArticleId());
fileDto.setContent(file.getContent());
fileDto.setFileName(file.getFileName());
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
articleContentDao.insert(fileDto);
}
ArticleContentEntity fileDto=new ArticleContentEntity();
fileDto.setCustomerId(formDTO.getCustomerId());
fileDto.setArticleId(formDTO.getArticleId());
fileDto.setContent(file.getContent());
fileDto.setFileName(file.getFileName());
fileDto.setContentType("file");
fileDto.setOrderNum(orderNum);
articleContentDao.insert(fileDto);
orderNum++;
}
}
//内容类型 图片:img;文字:text;文件:file 富文本:rich_text 如果是工作端小程序发布的文章,在pc编辑后,img和text删除。
LambdaUpdateWrapper<ArticleContentEntity> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.eq(ArticleContentEntity::getArticleId,formDTO.getArticleId())
.ne(ArticleContentEntity::getContentType,"rich_text")
.ne(ArticleContentEntity::getContentType,"file")
.set(ArticleContentEntity::getDelFlag,NumConstant.ONE_STR)
.set(ArticleContentEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId())
.set(ArticleContentEntity::getUpdatedTime,new Date());
articleContentDao.update(null,updateWrapper);
// 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(formDTO.getCustomerId());

21
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

@ -437,6 +437,7 @@
a.org_id AS "agencyId",
a.title AS "title",
a.category AS "category",
cd.CATEGORY_NAME,
IFNULL(a.preview_content, "") AS "previewContent",
a.publish_range_desc AS "publishRangeDesc",
a.publisher_id AS "publisher",
@ -453,16 +454,24 @@
ac.img_url AS "imgUrl"
FROM
article a
inner join category_dict cd on (cd.DEL_FLAG = 0 and a.CATEGORY = cd.ID)
LEFT JOIN article_cover ac ON a.id = ac.article_id AND ac.del_flag = '0'
WHERE
a.del_flag = '0'
<!-- 栏目 -->
<if test="subCategories != null and subCategories.size() > 0">
and a.CATEGORY in (
<foreach collection="subCategories" item="category" separator=",">
#{category}
</foreach>
)
<if test="(subCategories != null and subCategories.size() > 0) or (category != null and category != '')">
and (
<if test="subCategories != null and subCategories.size() > 0">
a.CATEGORY in (
<foreach collection="subCategories" item="ctg" separator=",">
#{ctg}
</foreach>
) or
</if>
<if test="category != null and category != ''">
a.CATEGORY = #{category}
</if>
)
</if>
<if test="articleId != null and articleId != '' ">
AND a.id = #{articleId}

Loading…
Cancel
Save