From 2762e01a72e93dc6703c06c701b28ceffe7c9de8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 07 Oct 2022 21:46:32 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java | 5 +++++
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java | 3 +++
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java | 3 +++
src/main/resources/mapper/ArticleMapper.xml | 2 +-
src/main/java/com/xcong/farmer/cms/core/node/Template.java | 2 ++
src/main/resources/logback-spring.xml | 2 +-
src/main/resources/mapper/CmsFriendlyLinkMapper.xml | 7 +++++++
src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java | 9 ++++++++-
src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java | 10 ++++++++++
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java | 3 +++
src/main/resources/application.yml | 4 ++--
src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java | 2 ++
12 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java b/src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java
index 0bd8d95..56ad076 100644
--- a/src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java
+++ b/src/main/java/com/xcong/farmer/cms/core/handler/FriendlyDataParserHandler.java
@@ -2,6 +2,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
import com.xcong.farmer.cms.core.node.AttrNode;
import com.xcong.farmer.cms.core.tag.data.FriendlyData;
import com.xcong.farmer.cms.core.tag.model.Ad;
@@ -26,7 +27,13 @@
Long companyId = (Long) attrNode.getSystemDataValue("companyId");
Friendly param = (Friendly) attrNode.getParam();
- List<CmsFriendlyLinkEntity> friendlies = cmsFriendlyLinkMapper.selectByGroupIdAndCompanyId(Long.parseLong(param.getGroupId()), companyId);
+ List<CmsFriendlyLinkEntity> friendlies = null;
+ if (StrUtil.isNotBlank(param.getGroupId())) {
+ friendlies = cmsFriendlyLinkMapper.selectByGroupIdAndCompanyId(Long.parseLong(param.getGroupId()), companyId);
+ } else {
+ friendlies = cmsFriendlyLinkMapper.selectByGroupCodeAndCompanyId(param.getCode(), companyId);
+ }
+
if (CollUtil.isEmpty(friendlies)) {
attrNode.setData(new FriendlyData());
} else {
diff --git a/src/main/java/com/xcong/farmer/cms/core/node/Template.java b/src/main/java/com/xcong/farmer/cms/core/node/Template.java
index 5770040..a2621db 100644
--- a/src/main/java/com/xcong/farmer/cms/core/node/Template.java
+++ b/src/main/java/com/xcong/farmer/cms/core/node/Template.java
@@ -117,6 +117,8 @@
FileOutputStream outputStream = new FileOutputStream(path + this.name + suffix);
outputStream.write(html.getBytes());
outputStream.close();
+
+ document = null;
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java b/src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java
index c684c10..d1a1601 100644
--- a/src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java
+++ b/src/main/java/com/xcong/farmer/cms/core/tag/model/Friendly.java
@@ -6,6 +6,8 @@
**/
public class Friendly {
+ private String code;
+
private String groupId;
private String field;
@@ -25,4 +27,12 @@
public void setField(String field) {
this.field = field;
}
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java
index bb90e22..56e45fd 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java
@@ -71,4 +71,7 @@
@ApiModelProperty(value = "保存状态 1-仅保存 2-保存并发布")
private int saveState;
+
+ @ApiModelProperty(value = "是否草稿 1-是 2-否")
+ private Integer draftState;
}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
index cb487cf..d182e59 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
@@ -73,4 +73,7 @@
@ApiModelProperty(value = "保存状态 1-仅保存 2-保存并发布")
private int saveState;
+
+ @ApiModelProperty(value = "是否草稿 1-是 2-否")
+ private Integer draftState;
}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
index 70d85ee..2465a4a 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
@@ -90,6 +90,11 @@
*/
private Long beforeColumnId;
+ /**
+ * 草稿状态 1-是 2-否
+ */
+ private Integer draftState;
+
@TableField(exist = false)
private String columnCode;
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java
index c58de60..30ea6cb 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/CmsFriendlyLinkMapper.java
@@ -12,4 +12,6 @@
Page<CmsFriendlyLinkEntity> selectInPage(Page<CmsFriendlyLinkEntity> page, @Param("record") CmsFriendlyLinkEntity cmsFriendlyLinkEntity);
List<CmsFriendlyLinkEntity> selectByGroupIdAndCompanyId(@Param("groupId") Long groupId, @Param("companyId") Long companyId);
+
+ List<CmsFriendlyLinkEntity> selectByGroupCodeAndCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
index 29928a0..d7c8967 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -131,6 +131,7 @@
articleEntity.setArticleUrl(adminAddArticleDto.getArticleUrl());
articleEntity.setType(adminAddArticleDto.getType());
articleEntity.setContentType(adminAddArticleDto.getContentType());
+ articleEntity.setDraftState(adminAddArticleDto.getDraftState());
this.baseMapper.insert(articleEntity);
if (adminAddArticleDto.getSaveState() == 2) {
@@ -214,6 +215,7 @@
String authorBelong = adminUpdateArticleDto.getAuthorBelong();
articleEntity.setAuthorBelong(authorBelong);
+ articleEntity.setDraftState(adminUpdateArticleDto.getDraftState());
this.baseMapper.updateById(articleEntity);
if (adminUpdateArticleDto.getSaveState() == 2) {
@@ -322,6 +324,7 @@
if(ObjectUtil.isEmpty(articleEntity)){
return Result.fail("文章不存在");
}
+ articleEntity.setDraftState(2);
articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_YES);
this.baseMapper.updateById(articleEntity);
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 7b8065c..67f13f1 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -113,7 +113,7 @@
cms:
api-url: http://120.27.238.55:8878
static-url: http://120.27.238.55:8000/cms/static/
- template-path: /Users/helius/Desktop/template-online/template
+ template-path: /Users/helius/Documents/xcong/cms/test/template
static-path: /Users/helius/Desktop/template-online/static
- output-path: /Users/helius/Desktop/template-online/output
+ output-path: /Users/helius/Documents/xcong/cms/test/output
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
index 15749d6..754b3f6 100644
--- a/src/main/resources/logback-spring.xml
+++ b/src/main/resources/logback-spring.xml
@@ -134,7 +134,7 @@
<!--开发环境:打印控制台-->
<springProfile name="dev">
- <logger name="com.kss.kssframework" level="debug"/>
+ <logger name="com.xcong.farmer.cms" level="debug"/>
</springProfile>
<root level="info">
diff --git a/src/main/resources/mapper/ArticleMapper.xml b/src/main/resources/mapper/ArticleMapper.xml
index d781c82..0def852 100644
--- a/src/main/resources/mapper/ArticleMapper.xml
+++ b/src/main/resources/mapper/ArticleMapper.xml
@@ -158,7 +158,7 @@
<select id="selectArticleByColumnId" resultType="com.xcong.farmer.cms.modules.system.entity.ArticleEntity">
select * from t_article a
- where a.column_id=#{columnId} and a.company_id=#{companyId} and a.del_status = 1
+ where a.column_id=#{columnId} and a.company_id=#{companyId} and a.del_status = 1 and draft_state=2
<if test="type != 4">
<if test="type == 2">
and release_status=1
diff --git a/src/main/resources/mapper/CmsFriendlyLinkMapper.xml b/src/main/resources/mapper/CmsFriendlyLinkMapper.xml
index db91272..edfe4b4 100644
--- a/src/main/resources/mapper/CmsFriendlyLinkMapper.xml
+++ b/src/main/resources/mapper/CmsFriendlyLinkMapper.xml
@@ -20,4 +20,11 @@
select * from cms_friendly_link
where group_id=#{groupId} and company_id=#{companyId}
</select>
+
+ <select id="selectByGroupCodeAndCompanyId" resultType="com.xcong.farmer.cms.modules.system.entity.CmsFriendlyLinkEntity">
+ select
+ *
+ from cms_friendly_link a, cms_group_info b
+ where a.group_id=b.id and b.code=#{code} and a.company_id=#{companyId}
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1