From 49dbcdadd860b7613063ee618fbe38a0593d5bd9 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 11 Jul 2022 15:45:29 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/farmer/cms/core/handler/ArticlesDataParserHandler.java | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/xcong/farmer/cms/core/handler/ArticlesDataParserHandler.java b/src/main/java/com/xcong/farmer/cms/core/handler/ArticlesDataParserHandler.java
index 61ecde7..f4d8011 100644
--- a/src/main/java/com/xcong/farmer/cms/core/handler/ArticlesDataParserHandler.java
+++ b/src/main/java/com/xcong/farmer/cms/core/handler/ArticlesDataParserHandler.java
@@ -4,6 +4,7 @@
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xcong.farmer.cms.configurations.properties.CmsProperties;
import com.xcong.farmer.cms.conversion.ArticleConversion;
import com.xcong.farmer.cms.core.node.AttrNode;
import com.xcong.farmer.cms.core.tag.data.ArticleData;
@@ -26,32 +27,42 @@
public class ArticlesDataParserHandler implements DataParserHandler {
private ArticleMapper articleMapper = SpringContextHolder.getBean(ArticleMapper.class);
+ private CmsProperties cmsProperties = SpringContextHolder.getBean(CmsProperties.class);
- private String BASE_URL = "http://192.168.0.1";
@Override
public void dataParser(AttrNode node) {
log.info("文章列表解析");
Long companyId = (Long) node.getSystemDataValue("companyId");
Articles param = (Articles) node.getParam();
-
+ ArticleEntity article = new ArticleEntity();
+ Page<ArticleEntity> page = new Page<>(Integer.parseInt(param.getPage()), Integer.parseInt(param.getLimit()));
if (StrUtil.isEmpty(param.getColId())) {
- Page<ArticleEntity> page = new Page<>(Integer.parseInt(param.getPage()), Integer.parseInt(param.getLimit()));
- ArticleEntity article = new ArticleEntity();
article.setColumnCode(param.getCode());
- article.setCompanyId(companyId);
- IPage<ArticleEntity> listPage = articleMapper.selectArticleInPage(page, article);
- List<ArticleData> list = new ArrayList<>();
- for (ArticleEntity record : listPage.getRecords()) {
- ArticleData articleData = entityToData(record);
- list.add(articleData);
- }
-
- node.setData(list);
} else {
+ List<String> colIdsStr = StrUtil.split(param.getColId(), ',');
+ List<Long> colIds = new ArrayList<>();
+ colIdsStr.forEach(item -> {
+ colIds.add(Long.parseLong(item));
+ });
+ article.setColumnIds(colIds);
}
+ article.setCompanyId(companyId);
+
+ Integer releaseType = (Integer) node.getSystemDataValue("releaseType");
+ article.setReleaseType(releaseType);
+
+ IPage<ArticleEntity> listPage = articleMapper.selectArticleInPage(page, article);
+
+ List<ArticleData> list = new ArrayList<>();
+ for (ArticleEntity record : listPage.getRecords()) {
+ ArticleData articleData = entityToData(record);
+ list.add(articleData);
+ }
+
+ node.setData(list);
}
public ArticleData entityToData(ArticleEntity article) {
@@ -60,7 +71,7 @@
if (article.getType() == 2) {
articleData.setUrl(article.getArticleUrl());
} else {
- articleData.setUrl(BASE_URL + article.getPath() + "/" + article.getId() + ".html");
+ articleData.setUrl(cmsProperties.getBaseUrl() + article.getPath() + "/" + article.getId() + ".html");
}
--
Gitblit v1.9.1