Commit 6b874025 authored by 他是超人他会飞's avatar 他是超人他会飞 Committed by 铭飞

!149 自定义模型字段搜索

Merge pull request !149 from 他是超人他会飞/4.7.0
parents 03e2ac9b c4ea16f0
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -287,7 +287,7 @@ public class ArticleAction extends BaseAction { ...@@ -287,7 +287,7 @@ public class ArticleAction extends BaseAction {
// 判断栏目是否存在新增字段 // 判断栏目是否存在新增字段
if (column.getColumnContentModelId() != 0) { if (column.getColumnContentModelId() != 0) {
// 保存所有的字段信息 // 保存所有的字段信息
List<BaseEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); List<ContentModelFieldEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId());
// 获取内容模型实体 // 获取内容模型实体
ContentModelEntity contentModel = (ContentModelEntity) contentBiz ContentModelEntity contentModel = (ContentModelEntity) contentBiz
.getEntity(column.getColumnContentModelId()); .getEntity(column.getColumnContentModelId());
...@@ -414,7 +414,7 @@ public class ArticleAction extends BaseAction { ...@@ -414,7 +414,7 @@ public class ArticleAction extends BaseAction {
// 判断栏目是否存在新增字段 // 判断栏目是否存在新增字段
if (column.getColumnContentModelId() != 0) { if (column.getColumnContentModelId() != 0) {
// 保存所有的字段信息 // 保存所有的字段信息
List<BaseEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); List<ContentModelFieldEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId());
ContentModelEntity newContentModel = (ContentModelEntity) contentBiz ContentModelEntity newContentModel = (ContentModelEntity) contentBiz
.getEntity(column.getColumnContentModelId()); .getEntity(column.getColumnContentModelId());
if (newContentModel != null) { if (newContentModel != null) {
...@@ -442,7 +442,7 @@ public class ArticleAction extends BaseAction { ...@@ -442,7 +442,7 @@ public class ArticleAction extends BaseAction {
// 判断该文章是否存在新增字段 // 判断该文章是否存在新增字段
if (column.getColumnContentModelId() != 0) { if (column.getColumnContentModelId() != 0) {
// 保存所有的字段信息 // 保存所有的字段信息
List<BaseEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId()); List<ContentModelFieldEntity> listField = fieldBiz.queryListByCmid(column.getColumnContentModelId());
// // update中的where条件 // // update中的where条件
Map<String, Integer> where = new HashMap<String, Integer>(); Map<String, Integer> where = new HashMap<String, Integer>();
// 压入默认的basicId字段 // 压入默认的basicId字段
...@@ -576,7 +576,7 @@ public class ArticleAction extends BaseAction { ...@@ -576,7 +576,7 @@ public class ArticleAction extends BaseAction {
* 文章id * 文章id
* @return 字段信息 * @return 字段信息
*/ */
private Map checkField(List<BaseEntity> listField, HttpServletRequest request, int articleId) { private Map checkField(List<ContentModelFieldEntity> listField, HttpServletRequest request, int articleId) {
Map<String, Object> mapParams = new HashMap(); Map<String, Object> mapParams = new HashMap();
// 压入默认的basicId字段 // 压入默认的basicId字段
mapParams.put("basicId", articleId); mapParams.put("basicId", articleId);
......
...@@ -227,7 +227,6 @@ public class ArticleAction extends BaseAction { ...@@ -227,7 +227,6 @@ public class ArticleAction extends BaseAction {
} }
} }
} }
this.outJson(response, JSONArray.toJSONString(new ListBean(list, BasicUtil.endPage(list)),new DateValueFilter("yyyy-MM-dd HH:mm:ss"))); this.outJson(response, JSONArray.toJSONString(new ListBean(list, BasicUtil.endPage(list)),new DateValueFilter("yyyy-MM-dd HH:mm:ss")));
} }
......
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
<result column="column_path" property="columnPath"/> <result column="column_path" property="columnPath"/>
<result column="column_url" property="columnUrl" /> <result column="column_url" property="columnUrl" />
<result column="category_title" property="categoryTitle" /> <result column="category_title" property="categoryTitle" />
<result column="column_category_id" property="categoryId"/><!-- 与Category类别类绑定ID -->
<result column="category_parent_id" property="categoryParentId" /><!-- 关联表category的父类型编号 -->
<result column="category_id" property="categoryId" /> <result column="category_id" property="categoryId" />
<result column="COLUMN_CM_ID" property="columnContentModelId" /> <result column="COLUMN_CM_ID" property="columnContentModelId" />
<result column="COLUMN_TYPE" property="columnType" /> <result column="COLUMN_TYPE" property="columnType" />
...@@ -318,7 +320,7 @@ ...@@ -318,7 +320,7 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 --> <!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select id="queryIdsByCategoryIdForParser" resultMap="resultMapBean" > <select id="queryIdsByCategoryIdForParser" resultMap="resultMapBean" >
select select
ARTICLE_BASICID,cl.* ARTICLE_BASICID,cl.*,c.*
FROM cms_article a LEFT JOIN basic b ON a.ARTICLE_BASICID = b.BASIC_ID FROM cms_article a LEFT JOIN basic b ON a.ARTICLE_BASICID = b.BASIC_ID
LEFT JOIN basic_column cl ON b.BASIC_CATEGORYID = cl.COLUMN_CATEGORY_ID LEFT JOIN basic_column cl ON b.BASIC_CATEGORYID = cl.COLUMN_CATEGORY_ID
JOIN category c ON c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID JOIN category c ON c.CATEGORY_ID = cl.COLUMN_CATEGORY_ID
......
...@@ -8,10 +8,7 @@ import java.util.HashMap; ...@@ -8,10 +8,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PageUtil; import cn.hutool.core.util.PageUtil;
import freemarker.cache.FileTemplateLoader; import freemarker.cache.FileTemplateLoader;
import freemarker.core.ParseException; import freemarker.core.ParseException;
...@@ -23,7 +20,6 @@ import net.mingsoft.base.constant.Const; ...@@ -23,7 +20,6 @@ import net.mingsoft.base.constant.Const;
import net.mingsoft.basic.entity.ColumnEntity; import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.SpringUtil; import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.bean.ColumnArticleIdBean; import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.constant.e.ColumnTypeEnum; import net.mingsoft.cms.constant.e.ColumnTypeEnum;
import net.mingsoft.mdiy.biz.IContentModelBiz; import net.mingsoft.mdiy.biz.IContentModelBiz;
...@@ -45,16 +41,12 @@ public class CmsParserUtil extends ParserUtil { ...@@ -45,16 +41,12 @@ public class CmsParserUtil extends ParserUtil {
public static void generate(String templatePath, String targetPath) throws IOException { public static void generate(String templatePath, String targetPath) throws IOException {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(IS_DO, false); map.put(IS_DO, false);
boolean mobileStyle = false; String content = CmsParserUtil.generate(templatePath, map, false);
String content = CmsParserUtil.generate(templatePath, map, mobileStyle);
FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8); FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8);
//判断是否有移动端 不能将这个判断放在上面,会出现PC端一直是移动端的内容
if (!StringUtil.isBlank(BasicUtil.getApp().getAppMobileStyle())) {
mobileStyle = true;
}
// 生成移动页面 // 生成移动页面
if (mobileStyle) { if (ParserUtil.isMobile(templatePath)) {
// 手机端m // 手机端m
map.put(ParserUtil.MOBILE, BasicUtil.getApp().getAppMobileStyle()); map.put(ParserUtil.MOBILE, BasicUtil.getApp().getAppMobileStyle());
content = CmsParserUtil.generate(templatePath, map, true); content = CmsParserUtil.generate(templatePath, map, true);
...@@ -109,6 +101,11 @@ public class CmsParserUtil extends ParserUtil { ...@@ -109,6 +101,11 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(RCOUNT, pageSize); parserParams.put(RCOUNT, pageSize);
parserParams.put(TYPE_ID, column.getCategoryId()); parserParams.put(TYPE_ID, column.getCategoryId());
parserParams.put(IS_DO, false); parserParams.put(IS_DO, false);
parserParams.put(HTML, HTML);
//如果单站点,就废弃站点地址
if(ParserUtil.IS_SINGLE) {
parserParams.put(ParserUtil.URL, BasicUtil.getUrl());
}
if (i == 0) { if (i == 0) {
// 数据库中第一页是从开始0*size // 数据库中第一页是从开始0*size
// 首页路径index.html // 首页路径index.html
...@@ -131,7 +128,7 @@ public class CmsParserUtil extends ParserUtil { ...@@ -131,7 +128,7 @@ public class CmsParserUtil extends ParserUtil {
FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8);
// 判断是手机端生成还是pc端,防止重复生成 // 判断是手机端生成还是pc端,防止重复生成
if (ObjectUtil.isNotNull(BasicUtil.getApp().getAppMobileStyle())) { if (ParserUtil.isMobile(column.getColumnListUrl())) {
writer = new StringWriter(); writer = new StringWriter();
mobileTemplate.process(null, writer); mobileTemplate.process(null, writer);
tag = new TagParser(writer.toString(),parserParams); tag = new TagParser(writer.toString(),parserParams);
...@@ -215,20 +212,27 @@ public class CmsParserUtil extends ParserUtil { ...@@ -215,20 +212,27 @@ public class CmsParserUtil extends ParserUtil {
parserParams.put(ID, articleId); parserParams.put(ID, articleId);
// 第一篇文章没有上一篇 // 第一篇文章没有上一篇
if (ai > 0) { if (ai > 0) {
parserParams.put(PRE_ID, articleIdList.get(ai - 1).getArticleId()); ColumnArticleIdBean preCaBean = articleIdList.get(ai - 1);
//判断当前文档是否与上一页文章在同一栏目下,并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if(articleColumnPath.contains(preCaBean.getCategoryId()+"")){
parserParams.put(PRE_ID, preCaBean.getArticleId());
}
} }
// 最后一篇文章没有下一篇 // 最后一篇文章没有下一篇
if (ai + 1 < articleIdList.size()) { if (ai + 1 < articleIdList.size()) {
parserParams.put(NEXT_ID, articleIdList.get(ai + 1).getArticleId()); ColumnArticleIdBean nextCaBean = articleIdList.get(ai + 1);
//判断当前文档是否与下一页文章在同一栏目下并且不能使用父栏目字符串,因为父栏目中没有所属栏目编号
if(articleColumnPath.contains(nextCaBean.getCategoryId()+"")){
parserParams.put(NEXT_ID, nextCaBean.getArticleId());
}
} }
parserParams.put(IS_DO, false); parserParams.put(IS_DO, false);
String content = CmsParserUtil.generate(articleIdList.get(ai).getColumnUrl(), parserParams, false); String content = CmsParserUtil.generate(articleIdList.get(ai).getColumnUrl(), parserParams, false);
FileUtil.writeString(content, writePath, Const.UTF8); FileUtil.writeString(content, writePath, Const.UTF8);
// 手机端 // 手机端
if (StringUtils.isNotEmpty(BasicUtil.getApp().getAppMobileStyle())) { if (ParserUtil.isMobile(columnUrl)) {
writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId); writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId);
//如果是封面就生成index.html //如果是封面就生成index.html
if(articleIdList.get(ai).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { if(articleIdList.get(ai).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) {
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
<div class="ms-content-main-div"> <div class="ms-content-main-div">
<ul class="ms-content-main-ul"> <ul class="ms-content-main-ul">
{ms:arclist size=20 ispaging=true } {ms:arclist size=10 ispaging=true}
<li> <li>
<a href="{ms:global.url/}[field.link/]"> <a href="{ms:global.url/}[field.link/]">
<!-- <span class="ms-content-main-li-span">·</span> --> <!-- <span class="ms-content-main-li-span">·</span> -->
<span class="ms-content-main-li-title">[field.title/]</span> <span class="ms-content-main-li-title">[field.title/]</span>
<span class="ms-content-main-li-time">[field.date?string("yyyy-mm-dd")/]</span> <span class="ms-content-main-li-time">[field.date?string("yyyy-MM-dd")/]</span>
</a> </a>
</li> </li>
{/ms:arclist} {/ms:arclist}
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="ms-content-right-main-icon-source">来源:{ms:field.source/} <div class="ms-content-right-main-icon-source">来源:{ms:field.source/}
<span class="ms-content-right-vertical">|</span> <span class="ms-content-right-vertical">|</span>
</div> </div>
<div class="ms-content-right-main-icon-time">时间:{ms:field.date?string("yyyy-mm-dd")/}</div> <div class="ms-content-right-main-icon-time">时间:{ms:field.date?string("yyyy-MM-dd")/}</div>
</div> </div>
<div class="ms-content-icon-right"> <div class="ms-content-icon-right">
<div class="ms-content-right-main-icon-clicks"></div> <div class="ms-content-right-main-icon-clicks"></div>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<!-- 共7个结果 --> <!-- 共7个结果 -->
</div> </div>
<ul class="ms-content-main-ul"> <ul class="ms-content-main-ul">
{ms:arclist size=3 ispaging=true} {ms:arclist size=10 ispaging=true}
<li> <li>
<a href="{ms:global.url/}/[field.link/]"> <a href="{ms:global.url/}/[field.link/]">
[field.title/] [field.title/]
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
</ul> </ul>
</div> </div>
<div class="ms-content-main-page"> <div class="ms-content-main-page">
<a href="jacascript::void(0)" @click="indexAndLast(1)">首页</a> <a class="ms-content-main-page-first" href="{ms:page.index/}">首页</a>
<a href="jacascript::void(0)" @click="search(false)">上一页</a> <a class="ms-content-main-page-upper" href="{ms:page.pre/}">上一页</a>
<a href="jacascript::void(0)" @click="search(true)">下一页</a> <a class="ms-content-main-page-next" href="{ms:page.next/}">下一页</a>
<a href="jacascript::void(0)" @click="indexAndLast({ms:page.total/})"></a> <a class="ms-content-main-page-last" href="{ms:page.last/}"></a>
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment