From 1a7c7f22251bfd7f09566ea934e58996d8624c83 Mon Sep 17 00:00:00 2001 From: 123 <123@qq.com> Date: Fri, 25 Apr 2025 14:13:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4article?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iteachyou/cms/taglib/tags/ArticleTag.java | 57 ++++++++++--------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/src/main/java/cc/iteachyou/cms/taglib/tags/ArticleTag.java b/src/main/java/cc/iteachyou/cms/taglib/tags/ArticleTag.java index d960e0b..00ff6a6 100644 --- a/src/main/java/cc/iteachyou/cms/taglib/tags/ArticleTag.java +++ b/src/main/java/cc/iteachyou/cms/taglib/tags/ArticleTag.java @@ -59,7 +59,7 @@ public class ArticleTag implements IParse { } cc.iteachyou.cms.entity.System system = systemService.getSystem(); String newHtml = html; - + Archives archives = archivesService.selectByPrimaryKey(id); Attribute[] attributes = annotations.attributes(); for (String string : all) { Map entity = new HashMap(); @@ -75,7 +75,7 @@ public class ArticleTag implements IParse { entity.put(key, value); } - Archives archives = archivesService.selectByPrimaryKey(id); + String formId = formService.queryDefaultForm().getId(); Category category = null; if (!"-1".equals(archives.getCategoryId())) { @@ -146,32 +146,35 @@ public class ArticleTag implements IParse { newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("createUserName")) ? "" : archivesVo.get("createUserName").toString()); } else if (FieldEnum.FIELD_CREATEREALNAME.getField().equalsIgnoreCase(name)) { newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("createRealName")) ? "" : archivesVo.get("createRealName").toString()); - } else if (FieldEnum.FIELD_CREATETIME.getField().equalsIgnoreCase(name)) { - if (StringUtil.isNotBlank(function)) { - newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("createTime"))); - } else { - newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("createTime")) ? "" : archivesVo.get("createTime").toString()); - } - } else if (FieldEnum.FIELD_UPDATEBY.getField().equalsIgnoreCase(name)) { - newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("updateBy")) ? "" : archivesVo.get("updateBy").toString()); - } else if (FieldEnum.FIELD_UPDATETIME.getField().equalsIgnoreCase(name)) { - if (StringUtil.isNotBlank(function)) { - newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("updateTime"))); - } else { - newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("updateTime")) ? "" : archivesVo.get("updateTime").toString()); - } - } else if (FieldEnum.FIELD_SHOWTIME.getField().equalsIgnoreCase(name)) { - if (StringUtil.isNotBlank(function)) { - newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("show_time"))); - } else { - newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("show_time")) ? "" : archivesVo.get("show_time").toString()); - } - } else if (FieldEnum.FIELD_ARCURL.getField().equalsIgnoreCase(name)) { - newHtml = newHtml.replace(string, "/article/" + archivesVo.get("aid").toString()); } else { - //处理附加字段 - if (archivesVo.containsKey(name)) - newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get(name)) ? "" : archivesVo.get(name).toString()); + String field = FieldEnum.FIELD_CREATETIME.getField(); + if (field.equalsIgnoreCase(name)) { + if (StringUtil.isNotBlank(function)) { + newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("createTime"))); + } else { + newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("createTime")) ? "" : archivesVo.get("createTime").toString()); + } + } else if (FieldEnum.FIELD_UPDATEBY.getField().equalsIgnoreCase(name)) { + newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("updateBy")) ? "" : archivesVo.get("updateBy").toString()); + } else if (FieldEnum.FIELD_UPDATETIME.getField().equalsIgnoreCase(name)) { + if (StringUtil.isNotBlank(function)) { + newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("updateTime"))); + } else { + newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("updateTime")) ? "" : archivesVo.get("updateTime").toString()); + } + } else if (FieldEnum.FIELD_SHOWTIME.getField().equalsIgnoreCase(name)) { + if (StringUtil.isNotBlank(function)) { + newHtml = newHtml.replace(string, FunctionUtil.replaceByFunction(function, archivesVo.get("show_time"))); + } else { + newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get("show_time")) ? "" : archivesVo.get("show_time").toString()); + } + } else if (FieldEnum.FIELD_ARCURL.getField().equalsIgnoreCase(name)) { + newHtml = newHtml.replace(string, "/article/" + archivesVo.get("aid").toString()); + } else { + //处理附加字段 + if (archivesVo.containsKey(name)) + newHtml = newHtml.replace(string, StringUtil.isBlank(archivesVo.get(name)) ? "" : archivesVo.get(name).toString()); + } } }