From 080fa960201f21f11fdfa39bef77a9c988b636af Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Tue, 31 Dec 2019 14:17:15 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/WEB-INF/manager/cms/content/main.ftl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/WEB-INF/manager/cms/content/main.ftl b/src/main/webapp/WEB-INF/manager/cms/content/main.ftl index f847815e..1ed62037 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/main.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/main.ftl @@ -4,6 +4,7 @@ 文章主体 <#include "../../include/head-file.ftl"> <#include "../../include/increase-search.ftl"> +
@@ -145,8 +146,8 @@ data:{ conditionList:[ {action:'and', field: 'content_title', el: 'eq', model: 'contentTitle', name: '文章标题', type: 'input'}, - {action:'and', field: 'content_category_id', el: 'eq', model: 'contentCategoryId', name: '所属栏目', type: 'cascader', multiple: false}, - {action:'and', field: 'content_type', el: 'eq', model: 'contentType', name: '文章类型', type: 'checkbox', label: false, multiple: true}, + {action:'and', field: 'content_category_id', el: 'eq', model: 'contentCategoryId', name: '所属栏目', key:'id',title:'categoryTitle', type: 'cascader', multiple: false}, + {action:'and', field: 'content_type', el: 'eq', model: 'contentType', name: '文章类型', key:'dictValue',title:'dictLabel', type: 'checkbox', label: false, multiple: true}, {action:'and', field: 'content_display', el: 'eq', model: 'contentDisplay', name: '是否显示', type: 'radio', label: true, multiple: false}, {action:'and', field: 'content_author', el: 'eq', model: 'contentAuthor', name: '文章作者', type: 'input'}, {action:'and', field: 'content_source', el: 'eq', model: 'contentSource', name: '文章来源', type: 'input'}, From 44f8dede77c8767fd1d734e06048a411ee4a9e82 Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Fri, 3 Jan 2020 11:42:40 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 31877027..ccf5f8ed 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -6,6 +6,7 @@ server: logging: level: net.mingsoft: trace + file: mcms.log ms: manager: path: /ms @@ -27,7 +28,6 @@ ms: - spring: profiles: active: dev @@ -61,10 +61,8 @@ spring: date_format: yyyy-MM-dd time_format: HH:mm:ss datetime_format: yyyy-MM-dd HH:mm:ss - auto_import: /include/macro.ftl as ms number_format: 0.## mybatis: - mapper-locations: classpath*:**/dao/*.xml - configuration: + configuration: database-id: mysql \ No newline at end of file From 1969450550e1ddccc7f00de9d9632e2772b27e45 Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Fri, 3 Jan 2020 11:57:37 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ccf5f8ed..e5b3e25f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 4027 + port: 8080 servlet.context-path: /ms-mcms servlet.session.timeout: 60M From 834cb473f5bc738e1f1df228ab4db758a360ffc9 Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Fri, 3 Jan 2020 16:49:51 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mingsoft/cms/action/web/MCmsAction.java | 384 +++++++----------- .../net/mingsoft/cms/biz/IContentBiz.java | 2 +- .../mingsoft/cms/biz/impl/ContentBizImpl.java | 6 +- .../net/mingsoft/cms/dao/IContentDao.java | 2 +- .../java/net/mingsoft/cms/dao/IContentDao.xml | 92 ++--- 5 files changed, 184 insertions(+), 302 deletions(-) diff --git a/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java b/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java index 3d87b7b5..c7c17e52 100644 --- a/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java +++ b/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java @@ -318,254 +318,164 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { -// /** -// * 实现前端页面的文章搜索 -// * -// * @param request -// * 搜索id -// * @param response -// */ -// @RequestMapping(value = "search") -// @ResponseBody -// public void search(HttpServletRequest request, HttpServletResponse response) { -// -// Map map = new HashMap<>(); -// // 读取请求字段 -// Map field = request.getParameterMap(); -// Map basicField = getMapByProperties(net.mingsoft.mdiy.constant.Const.BASIC_FIELD); -// // 文章字段集合 -// Map articleFieldName = new HashMap(); -// // 自定义字段集合 -// Map diyFieldName = new HashMap(); -// CategoryEntity column = null; // 当前栏目 -// ModelEntity contentModel = null; // 栏目对应模型 -// List fieldValueList = new ArrayList(); // 栏目对应字段的值 -// int typeId = 0; -// String categoryIds = BasicUtil.getString("categoryId"); -// //当传递了栏目编号,但不是栏目集合 -// if(!StringUtil.isBlank(categoryIds) && !categoryIds.contains(",")){ -// typeId = Integer.parseInt(categoryIds); -// } -// //记录自定义模型字段名 -// List filedStr = new ArrayList<>(); -// //根据栏目确定自定义模型 -// if(typeId>0){ -// column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+"")); -// // 获取表单类型的id -// if (column != null&&ObjectUtil.isNotNull(column.getMdiyModelId())) { -// contentModel = (ModelEntity) modelBiz.getEntity(Integer.parseInt(column.getMdiyModelId())); -// if (contentModel != null) { -// Map fieldMap = contentModel.getFieldMap(); -// for (String s : fieldMap.keySet()) { -// filedStr.add(fieldMap.get(s)); -// } -// map.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); -// } -// } -// map.put(ParserUtil.COLUMN, column); -// //设置栏目编号 -//// map.put(ParserUtil.TYPE_ID, typeId); -// } -// -// // 遍历取字段集合 -// if (field != null) { -// for (Map.Entry entry : field.entrySet()) { -// if (entry != null) { -// String value = entry.getValue()[0]; // 处理由get方法请求中文乱码问题 -// if (ObjectUtil.isNull(value)) { -// continue; -// } -// if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转吗 -// try { -// value = new String(value.getBytes("ISO-8859-1"), Const.UTF8); -// } catch (UnsupportedEncodingException e) { -// e.printStackTrace(); -// } -// } -// // 若为文章字段,则保存至文章字段集合;否则保存至自定义字段集合 -// if (ObjectUtil.isNotNull(basicField.get(entry.getKey())) && ObjectUtil.isNotNull(value)) { -// articleFieldName.put(entry.getKey(), value); -// } else { -// if (!StringUtil.isBlank(value)) { -// diyFieldName.put(entry.getKey(), value); -// //判断请求中的是否是自定义模型中的字段 -// if(filedStr.contains(entry.getKey())){ -// //设置自定义模型字段和值 -// DiyModelMap diyMap = new DiyModelMap(); -// diyMap.setKey(entry.getKey()); -// diyMap.setValue(value); -// fieldValueList.add(diyMap); -// } -// } -// } -// } -// } -// } -// //添加自定义模型的字段和值 -// if(fieldValueList.size()>0){ -// map.put("diyModel", fieldValueList); -// } -// //组织where查询条件 -// Map whereMap = ObjectUtil.isNotNull(contentModel)? -// this.searchMap(articleFieldName, diyFieldName, JSONArray.parseArray(contentModel.getModelField())): -// new HashMap(); -// -// // 获取符合条件的文章总数 -// int count = contentBiz.getSearchCount(contentModel, whereMap, BasicUtil.getAppId(), categoryIds); -// //设置分页类 -// PageBean page = new PageBean(); -// //读取模板的分页数量 -// int size = BasicUtil.getInt(ParserUtil.SIZE,10); -// try { -// size = TagParser.getPageSize(ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,false )); -// } catch (TemplateNotFoundException e1) { -// e1.printStackTrace(); -// } catch (MalformedTemplateNameException e1) { -// e1.printStackTrace(); -// } catch (ParseException e1) { -// e1.printStackTrace(); -// } catch (IOException e1) { -// e1.printStackTrace(); -// } -// int total = PageUtil.totalPage(count, size); -// -// int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1); -// if(pageNo >= total && total!=0) { -// pageNo = total; -// } -// //获取总数 -// page.setTotal(total); -// //设置页面显示数量 -// page.setSize(size); -// //设置列表当前页 -// -// page.setPageNo(pageNo); -// -// String str = ParserUtil.PAGE_NO+","+ParserUtil.SIZE; -// //设置分页的统一链接 -// String url = BasicUtil.getUrl()+request.getServletPath() +"?" + BasicUtil.assemblyRequestUrlParams(str.split(",")); -// String pageNoStr = "&"+ParserUtil.SIZE+"="+size+"&"+ParserUtil.PAGE_NO+"="; -// //下一页 -// String nextUrl = url + pageNoStr+((pageNo+1 > total)?total:pageNo+1); -// //首页 -// String indexUrl = url + pageNoStr + 1; -// //尾页 -// String lastUrl = url + pageNoStr + total; -// //上一页 当前页为1时,上一页就是1 -// String preUrl = url + pageNoStr + ((pageNo==1) ? 1:pageNo-1); -// -// page.setIndexUrl(indexUrl); -// page.setNextUrl(nextUrl); -// page.setPreUrl(preUrl); -// page.setLastUrl(lastUrl); -// map.put(ParserUtil.URL, BasicUtil.getUrl()); -// Map searchMap = BasicUtil.assemblyRequestMap(); -// searchMap.put(ParserUtil.PAGE_NO, pageNo); -// map.put(SEARCH, searchMap); -// map.put(ParserUtil.PAGE, page); -// //动态解析 -// map.put(ParserUtil.IS_DO,false); -// //设置动态请求的模块路径 -// map.put(ParserUtil.MODEL_NAME, "mcms"); -// //解析后的内容 -// String content = ""; -// try { -// //根据模板路径,参数生成 -// content = CmsParserUtil.generate(SEARCH+ParserUtil.HTM_SUFFIX,map, isMobileDevice(request)); -// } catch (TemplateNotFoundException e) { -// e.printStackTrace(); -// } catch (MalformedTemplateNameException e) { -// e.printStackTrace(); -// } catch (ParseException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// this.outString(response, content); -// } - /** - * 动态组织查询where条件 获取查询条件的Map key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段 - * list[1]:是否为整形 list[2]:是否是等值查询 list[3]:字段的值 + * 实现前端页面的文章搜索 * - * @param articleField - * 文章字段 - * @param diyFieldName - * 动态字段 - * @param fields - * 模型对应的字段类型 - * @return + * @param request + * 搜索id + * @param response */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private Map searchMap(Map articleField, Map diyFieldName, - List fields) { - Map map = new HashMap(); - - // 遍历文章中的字段 - for (Iterator iter = articleField.keySet().iterator(); iter.hasNext();) { - String key = iter.next().toString(); - String fieldValue = articleField.get(key).toString(); - List list = new ArrayList(); - List listValue = new ArrayList(); - // 是否为自定义字段 - list.add(false); - - // 是否是数字类型,true:不是 - list.add(true); - // 是否是模糊查询3 - list.add(true); - // 字段值 - listValue.add(articleField.get(key)); - list.add(listValue); - map.put(key, list); + @RequestMapping(value = "search") + @ResponseBody + public void search(HttpServletRequest request, HttpServletResponse response) { + + Map map = new HashMap<>(); + // 读取请求字段 + Map field = request.getParameterMap(); + // 文章字段集合 + Map articleFieldName = new HashMap(); + // 自定义字段集合 + Map diyFieldName = new HashMap(); + CategoryEntity column = null; // 当前栏目 + ModelEntity contentModel = null; // 栏目对应模型 + List fieldValueList = new ArrayList(); // 栏目对应字段的值 + int typeId = 0; + String categoryIds = BasicUtil.getString("categoryId"); + //当传递了栏目编号,但不是栏目集合 + if(!StringUtil.isBlank(categoryIds) && !categoryIds.contains(",")){ + typeId = Integer.parseInt(categoryIds); + } + //记录自定义模型字段名 + List filedStr = new ArrayList<>(); + //根据栏目确定自定义模型 + if(typeId>0){ + column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+"")); + // 获取表单类型的id + if (column != null&&ObjectUtil.isNotNull(column.getMdiyModelId())) { + contentModel = (ModelEntity) modelBiz.getEntity(Integer.parseInt(column.getMdiyModelId())); + if (contentModel != null) { + Map fieldMap = contentModel.getFieldMap(); + for (String s : fieldMap.keySet()) { + filedStr.add(fieldMap.get(s)); + } + map.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); + } + } + map.put(ParserUtil.COLUMN, column); } - // 遍历字段自定义字段 - for (Iterator iter = diyFieldName.keySet().iterator(); iter.hasNext();) { - String key = iter.next().toString(); - String fieldValue = diyFieldName.get(key); - // 获取字段实体 - Map field = get(key, fields); - if (field != null) { - List list = new ArrayList(); - // 是否为自定义字段0 - list.add(0, true); - List listValue = new ArrayList(); - // 字段的值 - if ("int".equals(field.get("javaType") ) || "float".equals(field.get("javaType") )|| "Double".equals(field.get("javaType")) ) { - // 判断是否为区间查询 - - if (diyFieldName.get(key).toString().indexOf("-") > 0) { - String[] values = fieldValue.toString().split("-"); - // 是否是数字类型,false:是 - list.add(false); - // 是否是区间比较 false:是 - list.add(false); - // 字段值1 - listValue.add(values[0]); - listValue.add(values[1]); - } else { - // 是否是数字类型,false:是2 - list.add(false); - // 是否是区间比较 true:不是3 - list.add(true); - // 字段值 1 - listValue.add(fieldValue); + // 遍历取字段集合 + if (field != null) { + for (Map.Entry entry : field.entrySet()) { + if (entry != null) { + String value = entry.getValue()[0]; // 处理由get方法请求中文乱码问题 + if (ObjectUtil.isNull(value)) { + continue; } - } else { - // 是否是数字类型,true:不是2 - list.add(true); - list.add(false); - // 字段值 1 - listValue.add(fieldValue); + if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转码 + try { + value = new String(value.getBytes("ISO-8859-1"), Const.UTF8); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + // 保存至自定义字段集合 + if (!StringUtil.isBlank(value)) { + diyFieldName.put(entry.getKey(), value); + //判断请求中的是否是自定义模型中的字段 + if(filedStr.contains(entry.getKey())){ + //设置自定义模型字段和值 + DiyModelMap diyMap = new DiyModelMap(); + diyMap.setKey(entry.getKey()); + diyMap.setValue(value); + fieldValueList.add(diyMap); + } + } + } - list.add(listValue); - map.put(key, list); } } - return map; + + //添加自定义模型的字段和值 + if(fieldValueList.size()>0){ + map.put("diyModel", fieldValueList); + } + + //设置分页类 + PageBean page = new PageBean(); + //读取模板的分页数量 + int size = BasicUtil.getInt(ParserUtil.SIZE,10); + try { + size = TagParser.getPageSize(ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,false )); + } catch (TemplateNotFoundException e1) { + e1.printStackTrace(); + } catch (MalformedTemplateNameException e1) { + e1.printStackTrace(); + } catch (ParseException e1) { + e1.printStackTrace(); + } catch (IOException e1) { + e1.printStackTrace(); + } + //查询数量 + int count= contentBiz.getSearchCount(contentModel,fieldValueList,BasicUtil.assemblyRequestMap(),BasicUtil.getAppId(),categoryIds); + int total = PageUtil.totalPage(count, size); + + int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1); + if(pageNo >= total && total!=0) { + pageNo = total; + } + //获取总数 + page.setTotal(total); + //设置页面显示数量 + page.setSize(size); + //设置列表当前页 + + page.setPageNo(pageNo); + + String str = ParserUtil.PAGE_NO+","+ParserUtil.SIZE; + //设置分页的统一链接 + String url = BasicUtil.getUrl()+request.getServletPath() +"?" + BasicUtil.assemblyRequestUrlParams(str.split(",")); + String pageNoStr = "&"+ParserUtil.SIZE+"="+size+"&"+ParserUtil.PAGE_NO+"="; + //下一页 + String nextUrl = url + pageNoStr+((pageNo+1 > total)?total:pageNo+1); + //首页 + String indexUrl = url + pageNoStr + 1; + //尾页 + String lastUrl = url + pageNoStr + total; + //上一页 当前页为1时,上一页就是1 + String preUrl = url + pageNoStr + ((pageNo==1) ? 1:pageNo-1); + + page.setIndexUrl(indexUrl); + page.setNextUrl(nextUrl); + page.setPreUrl(preUrl); + page.setLastUrl(lastUrl); + map.put(ParserUtil.URL, BasicUtil.getUrl()); + Map searchMap = BasicUtil.assemblyRequestMap(); + searchMap.put(ParserUtil.PAGE_NO, pageNo); + map.put(SEARCH, searchMap); + map.put(ParserUtil.PAGE, page); + //动态解析 + map.put(ParserUtil.IS_DO,false); + //设置动态请求的模块路径 + map.put(ParserUtil.MODEL_NAME, "mcms"); + //解析后的内容 + String content = ""; + try { + //根据模板路径,参数生成 + content = CmsParserUtil.generate(SEARCH+ParserUtil.HTM_SUFFIX,map, isMobileDevice(request)); + } catch (TemplateNotFoundException e) { + e.printStackTrace(); + } catch (MalformedTemplateNameException e) { + e.printStackTrace(); + } catch (ParseException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + this.outString(response, content); } + private Map get(String key, List fields) { for (Map field : fields) { if(key.equals(field.get("key"))){ diff --git a/src/main/java/net/mingsoft/cms/biz/IContentBiz.java b/src/main/java/net/mingsoft/cms/biz/IContentBiz.java index 581881e5..52faf36e 100644 --- a/src/main/java/net/mingsoft/cms/biz/IContentBiz.java +++ b/src/main/java/net/mingsoft/cms/biz/IContentBiz.java @@ -20,5 +20,5 @@ public interface IContentBiz extends IBaseBiz { List queryIdsByCategoryIdForParser(String categoryId, String beginTime, String endTime, String orderBy, String order); - int getSearchCount(ModelEntity contentModel, Map whereMap, int appId, String categoryIds); + int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds); } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java b/src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java index a41ef4bb..8a01fb38 100644 --- a/src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java +++ b/src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java @@ -63,10 +63,10 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz { } @Override - public int getSearchCount(ModelEntity contentModel, Map whereMap, int appId, String categoryIds) { + public int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds) { if (contentModel!=null) { - return contentDao.getSearchCount(contentModel.getModelTableName(),whereMap, appId,categoryIds); + return contentDao.getSearchCount(contentModel.getModelTableName(),diyList,whereMap, appId,categoryIds); } - return contentDao.getSearchCount(null,whereMap, appId,categoryIds); + return contentDao.getSearchCount(null,null,whereMap, appId,categoryIds); } } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/IContentDao.java b/src/main/java/net/mingsoft/cms/dao/IContentDao.java index 2f61868b..d92f57f3 100644 --- a/src/main/java/net/mingsoft/cms/dao/IContentDao.java +++ b/src/main/java/net/mingsoft/cms/dao/IContentDao.java @@ -34,6 +34,6 @@ public interface IContentDao extends IBaseDao { * list[2]:是否是等值查询 list[3]:字段的值 * @return 文章实体总数 */ - int getSearchCount(@Param("tableName") String tableName, @Param("map") Map map, + int getSearchCount(@Param("tableName") String tableName, @Param("diyList") List diyList,@Param("map") Map map, @Param("websiteId") int websiteId, @Param("ids") String ids); } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml index cfea7f07..1e680907 100644 --- a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml @@ -254,71 +254,43 @@ left join cms_category c ON a.content_category_id = c.id - left join ${tableName} d on d.link_id=a.id + left join ${tableName} d on d.link_id=a.id - where a.app_id = #{websiteId} - - and FIND_IN_SET(content_category_id,'${ids}') - - - - and ${key} + + a.app_id = #{websiteId} + + and FIND_IN_SET(content_category_id,'${ids}') + + + and a.content_title like CONCAT("%",'${map.content_title}',"%") + + + and a.content_author like CONCAT("%",'${map.content_author}',"%") + + + and a.content_source like CONCAT("%",'${map.content_source}',"%") + + + and a.content_type like CONCAT("%",'${map.content_type}',"%") + + + and a.content_description like CONCAT("%",'${map.content_description}',"%") - - and d.${key} + + and a.content_keyword like CONCAT("%",'${map.content_keyword}',"%") - - - - - = - #{val} - - - - between - - #{val} - - + + and a.content_details like CONCAT("%",'${map.content_details}',"%") - - - - - - - - = - #{val} - - + + + and d.${item.key} like CONCAT("%",'${item.value}',"%") + - + + - - - like CONCAT("%", - - #{val} - - ,"%") - - - like '%'|| - - #{val} - - ||'%' - - - like '%'+ - - #{val} - - +'%' - + \ No newline at end of file From 30ef12ada07cf101ab099406b7229db2b1df157f Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Fri, 3 Jan 2020 18:21:00 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/mingsoft/config/SwaggerConfig.java | 2 + src/main/resources/application.yml | 55 ++++++++++--------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/main/java/net/mingsoft/config/SwaggerConfig.java b/src/main/java/net/mingsoft/config/SwaggerConfig.java index 64926c60..fc856b46 100644 --- a/src/main/java/net/mingsoft/config/SwaggerConfig.java +++ b/src/main/java/net/mingsoft/config/SwaggerConfig.java @@ -1,5 +1,6 @@ package net.mingsoft.config; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -13,6 +14,7 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration +@ConditionalOnProperty(prefix="ms",name = "swagger.enable", havingValue = "true") public class SwaggerConfig { @Bean diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index e5b3e25f..915d8dbe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,29 +2,32 @@ server: port: 8080 servlet.context-path: /ms-mcms servlet.session.timeout: 60M - + logging: - level: - net.mingsoft: trace - file: mcms.log + level: + net.mingsoft: trace + file: mcms.log #日志文件存放位置 + path: log #日志压缩文件存放位置 ms: - manager: - path: /ms - view-path: /WEB-INF/manager - - upload: - path: upload - mapping: /upload/** - denied: .exe,.jsp - multipart: - #最大上传文件大小 单位:KB - max-file-size: 10240 - #文件暂存临时目录 - upload-temp-dir: temp - #临时文件大小 - max-in-memory-size: 10240 - #总上传最大大小 单位:KB -1禁用 - max-request-size: -1 + swagger: + enable: true #启用swagger文档 + manager: + path: /ms + view-path: /WEB-INF/manager + + upload: + path: upload + mapping: /upload/** + denied: .exe,.jsp + multipart: + #最大上传文件大小 单位:KB + max-file-size: 10240 + #文件暂存临时目录 + upload-temp-dir: temp + #临时文件大小 + max-in-memory-size: 10240 + #总上传最大大小 单位:KB -1禁用 + max-request-size: -1 @@ -32,8 +35,8 @@ spring: profiles: active: dev mvc: - pathmatch: - use-suffix-pattern: true + pathmatch: + use-suffix-pattern: true devtools: restart: enabled: true @@ -54,7 +57,7 @@ spring: expose-spring-macro-helpers: true prefer-file-system-access: false template-loader-path: classpath:/WEB-INF/manager,classpath:/WEB-INF - settings: + settings: template_update_delay: 1 default_encoding: UTF-8 classic_compatible: true @@ -62,7 +65,7 @@ spring: time_format: HH:mm:ss datetime_format: yyyy-MM-dd HH:mm:ss number_format: 0.## - + mybatis: configuration: - database-id: mysql \ No newline at end of file + database-id: mysql \ No newline at end of file From 530598f0c672e9df8a46e4d69fb79852424fdbc3 Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Sat, 4 Jan 2020 11:05:16 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=A0=E6=B3=95=E6=B8=B2=E6=9F=93=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/mingsoft/cms/util/CmsParserUtil.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java index 608ed55c..2a7d7e92 100644 --- a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java +++ b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java @@ -1,13 +1,5 @@ package net.mingsoft.cms.util; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.PageUtil; import freemarker.cache.FileTemplateLoader; @@ -17,28 +9,32 @@ import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateNotFoundException; import net.mingsoft.base.constant.Const; -import net.mingsoft.basic.entity.ColumnEntity; import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.SpringUtil; -import net.mingsoft.cms.bean.ColumnArticleIdBean; import net.mingsoft.cms.bean.ContentBean; import net.mingsoft.cms.constant.e.ColumnTypeEnum; import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.mdiy.bean.PageBean; -import net.mingsoft.mdiy.biz.IContentModelBiz; import net.mingsoft.mdiy.biz.IModelBiz; import net.mingsoft.mdiy.biz.impl.ModelBizImpl; -import net.mingsoft.mdiy.entity.ContentModelEntity; import net.mingsoft.mdiy.entity.ModelEntity; import net.mingsoft.mdiy.parser.TagParser; import net.mingsoft.mdiy.util.ParserUtil; import org.apache.commons.lang3.StringUtils; -public class CmsParserUtil extends ParserUtil { +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +public class CmsParserUtil extends ParserUtil { + private static int COLUMN_TYPE_COVER = 2; /** * 指定模板,指定路径进行生成静态页面,会自定识别pc与移动端 - * + * * @param templatePath * 模板路径 * @param targetPath @@ -53,7 +49,7 @@ public class CmsParserUtil extends ParserUtil { map.put(COLUMN, column); String content = CmsParserUtil.generate(templatePath, map, false); FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8); - + // 生成移动页面 if (ParserUtil.hasMobileFile(templatePath)) { // 手机端m @@ -188,7 +184,7 @@ public class CmsParserUtil extends ParserUtil { /** * 生成内容 - * + * * @param articleIdList * 文章集合 * @return @@ -227,7 +223,7 @@ public class CmsParserUtil extends ParserUtil { } // 判断文件是否存在,若不存在弹出返回信息 - if (!FileUtil.exist(ParserUtil.buildTempletPath(columnUrl))) { + if (!FileUtil.exist(ParserUtil.buildTempletPath(columnUrl))||StringUtils.isBlank(articleIdList.get(artId).getCategoryId())) { artId++; continue; } From 3daa94b1eed100967635b87f9217f25c4f71ffad Mon Sep 17 00:00:00 2001 From: sgjj <995959152@qq.com> Date: Sat, 4 Jan 2020 15:04:13 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0mysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 74b5f90a..21577407 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,12 @@ + + + + + + net.mingsoft ms-mpeople