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 附件 // 2.1 附件
if(!CollectionUtils.isEmpty(formDTO.getFileList())){ 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; int orderNum=2;
for(UpdateArticleFormDTO.ContentDTO file:formDTO.getFileList()){ for(UpdateArticleFormDTO.ContentDTO file:formDTO.getFileList()){
if(StringUtils.isNotBlank(file.getFileId())){ ArticleContentEntity fileDto=new ArticleContentEntity();
LambdaUpdateWrapper<ArticleContentEntity> updateWrapper=new LambdaUpdateWrapper<>(); fileDto.setCustomerId(formDTO.getCustomerId());
updateWrapper.set(ArticleContentEntity::getContent,file.getContent()) fileDto.setArticleId(formDTO.getArticleId());
.set(ArticleContentEntity::getFileName,file.getFileName()) fileDto.setContent(file.getContent());
.set(ArticleContentEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId()) fileDto.setFileName(file.getFileName());
.set(ArticleContentEntity::getUpdatedTime,new Date()) fileDto.setContentType("file");
.set(ArticleContentEntity::getOrderNum,orderNum) fileDto.setOrderNum(orderNum);
.eq(ArticleContentEntity::getId,file.getFileId()); articleContentDao.insert(fileDto);
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);
}
orderNum++; 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.操作记录 // 3.操作记录
ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity(); ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity();
articleOperateRecord.setCustomerId(formDTO.getCustomerId()); 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.org_id AS "agencyId",
a.title AS "title", a.title AS "title",
a.category AS "category", a.category AS "category",
cd.CATEGORY_NAME,
IFNULL(a.preview_content, "") AS "previewContent", IFNULL(a.preview_content, "") AS "previewContent",
a.publish_range_desc AS "publishRangeDesc", a.publish_range_desc AS "publishRangeDesc",
a.publisher_id AS "publisher", a.publisher_id AS "publisher",
@ -453,16 +454,24 @@
ac.img_url AS "imgUrl" ac.img_url AS "imgUrl"
FROM FROM
article a 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' LEFT JOIN article_cover ac ON a.id = ac.article_id AND ac.del_flag = '0'
WHERE WHERE
a.del_flag = '0' a.del_flag = '0'
<!-- 栏目 --> <!-- 栏目 -->
<if test="subCategories != null and subCategories.size() > 0"> <if test="(subCategories != null and subCategories.size() > 0) or (category != null and category != '')">
and a.CATEGORY in ( and (
<foreach collection="subCategories" item="category" separator=","> <if test="subCategories != null and subCategories.size() > 0">
#{category} a.CATEGORY in (
</foreach> <foreach collection="subCategories" item="ctg" separator=",">
) #{ctg}
</foreach>
) or
</if>
<if test="category != null and category != ''">
a.CATEGORY = #{category}
</if>
)
</if> </if>
<if test="articleId != null and articleId != '' "> <if test="articleId != null and articleId != '' ">
AND a.id = #{articleId} AND a.id = #{articleId}

Loading…
Cancel
Save