diff --git a/src/main/java/net/mingsoft/cms/action/CategoryAction.java b/src/main/java/net/mingsoft/cms/action/CategoryAction.java index 2f355a65..ad7761b6 100644 --- a/src/main/java/net/mingsoft/cms/action/CategoryAction.java +++ b/src/main/java/net/mingsoft/cms/action/CategoryAction.java @@ -102,6 +102,7 @@ public class CategoryAction extends BaseAction{ @RequestMapping("/list") @ResponseBody public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { + category.setAppId(BasicUtil.getAppId()); BasicUtil.startPage(); List categoryList = categoryBiz.query(category); return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal())); @@ -131,6 +132,7 @@ public class CategoryAction extends BaseAction{ if(category.getId()==null) { return ResultData.build().error(); } + category.setAppId(BasicUtil.getAppId()); CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId())); return ResultData.build().success(_category); } @@ -188,6 +190,7 @@ public class CategoryAction extends BaseAction{ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){ return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); } + category.setAppId(BasicUtil.getAppId()); categoryBiz.saveEntity(category); return ResultData.build().success(category); } @@ -262,6 +265,7 @@ public class CategoryAction extends BaseAction{ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){ return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); } + category.setAppId(BasicUtil.getAppId()); categoryBiz.updateEntity(category); return ResultData.build().success(category); } diff --git a/src/main/java/net/mingsoft/cms/action/ContentAction.java b/src/main/java/net/mingsoft/cms/action/ContentAction.java index 21cc95c6..3d6356a0 100644 --- a/src/main/java/net/mingsoft/cms/action/ContentAction.java +++ b/src/main/java/net/mingsoft/cms/action/ContentAction.java @@ -1,17 +1,10 @@ package net.mingsoft.cms.action; import java.util.List; -import java.io.File; -import java.util.ArrayList; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.alibaba.fastjson.JSON; import net.mingsoft.base.entity.ResultData; -import org.apache.commons.lang3.StringUtils; import org.springframework.validation.BindingResult; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.ui.ModelMap; @@ -20,19 +13,15 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import net.mingsoft.cms.biz.IContentBiz; import net.mingsoft.cms.entity.ContentEntity; -import net.mingsoft.base.util.JSONObject; import net.mingsoft.base.entity.BaseEntity; import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.StringUtil; -import net.mingsoft.base.filter.DateValueFilter; -import net.mingsoft.base.filter.DoubleValueFilter; import net.mingsoft.basic.bean.EUListBean; import net.mingsoft.basic.annotation.LogAnn; import net.mingsoft.basic.constant.e.BusinessTypeEnum; @@ -105,6 +94,7 @@ public class ContentAction extends BaseAction{ @RequestMapping("/list") @ResponseBody public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { + content.setAppId(BasicUtil.getAppId()); BasicUtil.startPage(); List contentList = contentBiz.query(content); return ResultData.build().success(new EUListBean(contentList,(int)BasicUtil.endPage(contentList).getTotal())); @@ -134,6 +124,7 @@ public class ContentAction extends BaseAction{ if(content.getId()==null) { return ResultData.build().error(); } + content.setAppId(BasicUtil.getAppId()); ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId())); return ResultData.build().success(_content); } @@ -191,6 +182,7 @@ public class ContentAction extends BaseAction{ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); } + content.setAppId(BasicUtil.getAppId()); contentBiz.saveEntity(content); return ResultData.build().success(content); } @@ -265,6 +257,7 @@ public class ContentAction extends BaseAction{ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); } + content.setAppId(BasicUtil.getAppId()); contentBiz.updateEntity(content); return ResultData.build().success(content); } diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index 66d48f9e..b2db92a2 100644 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -24,7 +24,6 @@ package net.mingsoft.cms.action; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -32,6 +31,9 @@ import javax.servlet.http.HttpServletResponse; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; +import net.mingsoft.cms.biz.ICategoryBiz; +import net.mingsoft.cms.entity.CategoryEntity; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -42,13 +44,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.alibaba.fastjson.JSONArray; import net.mingsoft.basic.action.BaseAction; -import net.mingsoft.basic.biz.IColumnBiz; import net.mingsoft.basic.biz.IModelBiz; import net.mingsoft.basic.entity.AppEntity; -import net.mingsoft.basic.entity.CategoryEntity; -import net.mingsoft.basic.entity.ColumnEntity; import net.mingsoft.cms.bean.ColumnArticleIdBean; import net.mingsoft.cms.biz.IArticleBiz; import net.mingsoft.cms.constant.ModelCode; @@ -84,7 +82,7 @@ public class GeneraterAction extends BaseAction { * 栏目管理业务层 */ @Autowired - private IColumnBiz columnBiz; + private ICategoryBiz categoryBiz; /** * 模块管理业务层 @@ -155,40 +153,42 @@ public class GeneraterAction extends BaseAction { * @param response * @param columnId */ - @RequestMapping("/{columnId}/genernateColumn") + @RequestMapping("/{CategoryId}/genernateColumn") @RequiresPermissions("cms:generate:column") @ResponseBody - public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable int columnId) { + public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable String CategoryId) { // 获取站点id AppEntity app = BasicUtil.getApp(); - List columns = new ArrayList(); + List columns = new ArrayList(); // 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目 - int modelId = BasicUtil.getModelCodeId(ModelCode.CMS_COLUMN); // 查询当前模块编号 - if (columnId > 0) { - List categorys = columnBiz.queryChildrenCategory(columnId, app.getAppId(), modelId); - for (CategoryEntity c : categorys) { - columns.add((ColumnEntity) columnBiz.getEntity(c.getCategoryId())); - } + if (StringUtils.isNotBlank(CategoryId)) { + CategoryEntity categoryEntity = new CategoryEntity(); + categoryEntity.setId(CategoryId); + categoryEntity.setAppId(app.getAppId()); + columns = categoryBiz.queryChilds(categoryEntity); } else { // 获取所有的内容管理栏目 - columns = columnBiz.queryAll(app.getAppId(), modelId); + CategoryEntity categoryEntity=new CategoryEntity(); + categoryEntity.setAppId(app.getAppId()); + columns = categoryBiz.query(categoryEntity); } List articleIdList = null; try { // 1、设置模板文件夹路径 // 获取栏目列表模版 - for (ColumnEntity column : columns) { + for (CategoryEntity column : columns) { // 判断模板文件是否存在 - if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getColumnUrl()))) { + if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryUrl()))) { continue; } - articleIdList = articleBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null); + articleIdList = articleBiz.queryIdsByCategoryIdForParser(Integer.parseInt(column.getCategoryId()), null, null); // 判断列表类型 - switch (column.getColumnType()) { - case ColumnEntity.COLUMN_TYPE_LIST: // 列表 + switch (column.getCategoryType()) { + //TODO 暂时先用字符串代替 + case "1": // 列表 CmsParserUtil.generateList(column, articleIdList.size()); break; - case ColumnEntity.COLUMN_TYPE_COVER:// 单页 + case "2":// 单页 if(articleIdList.size()==0){ ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean(); CopyOptions copyOptions=CopyOptions.create(); @@ -198,8 +198,6 @@ public class GeneraterAction extends BaseAction { } CmsParserUtil.generateBasic(articleIdList); break; - default: - throw new IllegalStateException("Unexpected value: " + column.getColumnType()); } } } catch (IOException e) { 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 9424bb51..1735259b 100644 --- a/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java +++ b/src/main/java/net/mingsoft/cms/action/web/MCmsAction.java @@ -196,7 +196,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { String content = ""; try { //根据模板路径,参数生成 - content = CmsParserUtil.generate(columnArticles.get(0).getColumnListUrl(),map, isMobileDevice(req)); + content = CmsParserUtil.generate(columnArticles.get(0).getCategoryListUrl(),map, isMobileDevice(req)); } catch (TemplateNotFoundException e) { e.printStackTrace(); } catch (MalformedTemplateNameException e) { @@ -251,20 +251,20 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { continue; } // 文章的栏目路径 - String articleColumnPath = articleIdList.get(artId).getColumnPath(); + String articleColumnPath = articleIdList.get(artId).getCategoryPath(); // 文章的栏目模型编号 - int columnContentModelId = articleIdList.get(artId).getColumnContentModelId(); + String columnContentModelId = articleIdList.get(artId).getMdiyModelId(); Map parserParams = new HashMap(); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); // 判断当前栏目是否有自定义模型 - if (columnContentModelId > 0) { + if ( StringUtils.isNotBlank(columnContentModelId)) { // 通过当前栏目的模型编号获取,自定义模型表名 if (contentModelMap.containsKey(columnContentModelId)) { parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); } else { // 通过栏目模型编号获取自定义模型实体 contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) - .getEntity(columnContentModelId); + .getEntity(Integer.parseInt(columnContentModelId)); // 将自定义模型编号设置为key值 contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); diff --git a/src/main/java/net/mingsoft/cms/bean/ColumnArticleIdBean.java b/src/main/java/net/mingsoft/cms/bean/ColumnArticleIdBean.java index 687135e8..e0ba5327 100644 --- a/src/main/java/net/mingsoft/cms/bean/ColumnArticleIdBean.java +++ b/src/main/java/net/mingsoft/cms/bean/ColumnArticleIdBean.java @@ -22,13 +22,14 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) package net.mingsoft.cms.bean; import net.mingsoft.basic.entity.ColumnEntity; +import net.mingsoft.cms.entity.CategoryEntity; /** * 文章解析生成 * @author 铭飞开源团队 * @date 2018年12月13日 */ -public class ColumnArticleIdBean extends ColumnEntity{ +public class ColumnArticleIdBean extends CategoryEntity { /** * 文章编号 */ diff --git a/src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java b/src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java index 46e121fc..f4bd357a 100644 --- a/src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java +++ b/src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java @@ -1,6 +1,9 @@ package net.mingsoft.cms.biz; import net.mingsoft.base.biz.IBaseBiz; +import net.mingsoft.cms.entity.CategoryEntity; + +import java.util.List; /** @@ -11,4 +14,14 @@ import net.mingsoft.base.biz.IBaseBiz; */ public interface ICategoryBiz extends IBaseBiz { + /** + * 查询当前分类下的所有子分类 + * @param category + * @return + */ + List queryChilds(CategoryEntity category); + + int saveEntity(CategoryEntity entity); + + void updateEntity(CategoryEntity entity); } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java b/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java index adfd2819..2188fe8a 100644 --- a/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java +++ b/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java @@ -21,12 +21,15 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技 package net.mingsoft.cms.biz.impl; +import net.mingsoft.base.entity.BaseEntity; +import net.mingsoft.cms.entity.CategoryEntity; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import net.mingsoft.base.biz.impl.BaseBizImpl; import net.mingsoft.base.dao.IBaseDao; import java.util.*; -import net.mingsoft.cms.entity.CategoryEntity; + import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.dao.ICategoryDao; @@ -48,5 +51,42 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz { protected IBaseDao getDao() { // TODO Auto-generated method stub return categoryDao; - } + } + + @Override + public List queryChilds(CategoryEntity category) { + // TODO Auto-generated method stub + return categoryDao.queryChildren(category); + } + @Override + public int saveEntity(CategoryEntity categoryEntity) { + // TODO Auto-generated method stub + setParentId(categoryEntity); + return super.saveEntity(categoryEntity); + } + + private void setParentId(CategoryEntity categoryEntity) { + if(StringUtils.isNotEmpty(categoryEntity.getCategoryId())&&Integer.parseInt(categoryEntity.getCategoryId())>0) { + CategoryEntity category = (CategoryEntity)categoryDao.getEntity(Integer.parseInt(categoryEntity.getCategoryId())); + if(StringUtils.isEmpty(category.getCategoryParentId())) { + categoryEntity.setCategoryParentId(categoryEntity.getCategoryId()); + } else { + categoryEntity.setCategoryParentId(category.getCategoryParentId()+","+categoryEntity.getCategoryParentId()); + } + } + } + + @Override + public void updateEntity(CategoryEntity entity) { + List categoryEntities = queryChilds(entity); + setParentId(entity); + super.updateEntity(entity); + categoryEntities.forEach(x->{ + setParentId(x); + if(!x.getId().equals(entity.getId())){ + super.updateEntity(x); + } + }); + + } } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.java b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.java index b84e2161..388c3ae0 100644 --- a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.java +++ b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.java @@ -2,7 +2,9 @@ package net.mingsoft.cms.dao; import net.mingsoft.base.dao.IBaseDao; import java.util.*; + import net.mingsoft.cms.entity.CategoryEntity; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Component; /** @@ -13,4 +15,12 @@ import org.springframework.stereotype.Component; */ @Component("cmsCategoryDao") public interface ICategoryDao extends IBaseDao { + + /** + * 查询当前分类下面的所有子分类 + * @param category 必须存在categoryId categoryParentId + * @return + */ + public List queryChildren(CategoryEntity category); + } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml index d4f58115..4752f31a 100644 --- a/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml @@ -90,7 +90,7 @@ update cms_category category_title=#{categoryTitle}, - category_id=#{categoryId}, + category_id=#{categoryId}, category_type=#{categoryType}, category_sort=#{categorySort}, category_list_url=#{categoryListUrl}, @@ -116,7 +116,7 @@ where id = #{id} - + @@ -151,6 +151,41 @@ limit 0,1 + + find_in_set('${id}',CATEGORY_PARENT_ID) + + + instr(','||'${id}'||',', ','||CATEGORY_PARENT_ID||',')>0 + + + CHARINDEX(','+'${id}'+',' , ','+CATEGORY_PARENT_ID +',')>0 + + + + diff --git a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml index b9f8bf80..cb97c6c9 100644 --- a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml @@ -18,7 +18,7 @@ - + @@ -45,7 +45,7 @@ content_details, content_url, content_hit, - appid, + app_id, create_by, create_date, update_by, @@ -67,7 +67,7 @@ #{contentDetails}, #{contentUrl}, #{contentHit}, - #{appid}, + #{appId}, #{createBy}, #{createDate}, #{updateBy}, @@ -94,7 +94,7 @@ content_details=#{contentDetails}, content_url=#{contentUrl}, content_hit=#{contentHit}, - appid=#{appid}, + app_id=#{appId}, create_by=#{createBy}, create_date=#{createDate}, update_by=#{updateBy}, @@ -127,7 +127,7 @@ and content_details=#{contentDetails} and content_url=#{contentUrl} and content_hit=#{contentHit} - and appid=#{appid} + and app_id=#{appId} and create_by=#{createBy} and create_date=#{createDate} and update_by=#{updateBy} @@ -173,7 +173,7 @@ and content_details=#{contentDetails} and content_url=#{contentUrl} and content_hit=#{contentHit} - and appid=#{appid} + and app_id=#{appId} and create_by=#{createBy} and create_date=#{createDate} and update_by=#{updateBy} diff --git a/src/main/java/net/mingsoft/cms/entity/ContentEntity.java b/src/main/java/net/mingsoft/cms/entity/ContentEntity.java index fe1ccdc2..59850a83 100644 --- a/src/main/java/net/mingsoft/cms/entity/ContentEntity.java +++ b/src/main/java/net/mingsoft/cms/entity/ContentEntity.java @@ -73,7 +73,7 @@ private static final long serialVersionUID = 1574925152617L; /** * 文章管理的应用id */ - private Integer appid; + private Integer appId; /** * 点击次数 */ @@ -259,14 +259,14 @@ private static final long serialVersionUID = 1574925152617L; /** * 设置文章管理的应用id */ - public void setAppid(Integer appid) { - this.appid = appid; + public void setAppId(Integer appId) { + this.appId = appId; } /** * 获取文章管理的应用id */ - public Integer getAppid() { - return this.appid; + public Integer getAppId() { + return this.appId; } } \ No newline at end of file diff --git a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java index 439c494b..79821d21 100644 --- a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java +++ b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java @@ -22,11 +22,15 @@ import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.SpringUtil; import net.mingsoft.cms.bean.ColumnArticleIdBean; 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.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 { @@ -42,9 +46,8 @@ public class CmsParserUtil extends ParserUtil { public static void generate(String templatePath, String targetPath) throws IOException { Map map = new HashMap(); map.put(IS_DO, false); - ColumnEntity column = new ColumnEntity(); + CategoryEntity column = new CategoryEntity(); //内容管理栏目编码 - column.setCategoryModelId(BasicUtil.getModelCodeId("02990000")); map.put(COLUMN, column); String content = CmsParserUtil.generate(templatePath, map, false); FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath), Const.UTF8); @@ -67,7 +70,7 @@ public class CmsParserUtil extends ParserUtil { * @throws ParseException * @throws IOException */ - public static void generateList(ColumnEntity column, int articleIdTotal) + public static void generateList(CategoryEntity column, int articleIdTotal) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException { // 只初始化一次cfg if (ftl == null) { @@ -76,12 +79,12 @@ public class CmsParserUtil extends ParserUtil { } // 移动端模板 Template mobileTemplate = cfg.getTemplate( - BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getColumnListUrl(), Const.UTF8); + BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getCategoryListUrl(), Const.UTF8); // pc端模板 - Template template = cfg.getTemplate(File.separator + column.getColumnListUrl(), Const.UTF8); + Template template = cfg.getTemplate(File.separator + column.getCategoryListUrl(), Const.UTF8); // 文章的栏目模型编号 - int columnContentModelId = column.getColumnContentModelId(); + String columnContentModelId = column.getMdiyModelId(); StringWriter writer = new StringWriter(); try { // 为了分页添加column,判断栏目是否为父栏目 @@ -94,11 +97,11 @@ public class CmsParserUtil extends ParserUtil { String columnListPath; String mobilePath; - ContentModelEntity contentModel = null; + ModelEntity contentModel = null; // 判断当前栏目是否有自定义模型 - if (columnContentModelId > 0) { + if (StringUtils.isNotBlank(columnContentModelId)) { // 通过栏目模型编号获取自定义模型实体 - contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class).getEntity(columnContentModelId); + contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId)); } int pageNo = 1; PageBean page = new PageBean(); @@ -112,7 +115,7 @@ public class CmsParserUtil extends ParserUtil { parserParams.put(APP_ID, BasicUtil.getAppId()); if (contentModel!=null) { // 将自定义模型编号设置为key值 - parserParams.put(TABLE_NAME, contentModel.getCmTableName()); + parserParams.put(TABLE_NAME, contentModel.getModelTableName()); } //如果单站点,就废弃站点地址 if(ParserUtil.IS_SINGLE) { @@ -123,15 +126,15 @@ public class CmsParserUtil extends ParserUtil { if (totalPageSize <= 0) { // 数据库中第一页是从开始0*size // 首页路径index.html - mobilePath = ParserUtil.buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); - columnListPath = ParserUtil.buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); + mobilePath = ParserUtil.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); // 设置分页的起始位置 page.setPageNo(pageNo); parserParams.put(ParserUtil.PAGE, page); TagParser tag = new TagParser(content,parserParams); FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); // 判断是手机端生成还是pc端,防止重复生成 - if (ParserUtil.hasMobileFile(column.getColumnListUrl())) { + if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) { writer = new StringWriter(); mobileTemplate.process(null, writer); tag = new TagParser(writer.toString(), parserParams); @@ -146,15 +149,15 @@ public class CmsParserUtil extends ParserUtil { // 数据库中第一页是从开始0*size // 首页路径index.html mobilePath = ParserUtil - .buildMobileHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); + .buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); columnListPath = ParserUtil - .buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.INDEX); + .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); } else { // 其他路径list-2.html mobilePath = ParserUtil.buildMobileHtmlPath( - column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); + column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); columnListPath = ParserUtil - .buildHtmlPath(column.getColumnPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); + .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); } // 设置分页的起始位置 page.setPageNo(pageNo); @@ -162,7 +165,7 @@ public class CmsParserUtil extends ParserUtil { TagParser tag = new TagParser(content,parserParams); FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); // 判断是手机端生成还是pc端,防止重复生成 - if (ParserUtil.hasMobileFile(column.getColumnListUrl())) { + if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) { writer = new StringWriter(); mobileTemplate.process(null, writer); tag = new TagParser(writer.toString(),parserParams); @@ -204,11 +207,11 @@ public class CmsParserUtil extends ParserUtil { // 文章编号 int articleId = articleIdList.get(artId).getArticleId(); // 文章的栏目路径 - String articleColumnPath = articleIdList.get(artId).getColumnPath(); + String articleColumnPath = articleIdList.get(artId).getCategoryPath(); // 文章的模板路径 - String columnUrl = articleIdList.get(artId).getColumnUrl(); + String columnUrl = articleIdList.get(artId).getCategoryUrl(); // 文章的栏目模型编号 - int columnContentModelId = articleIdList.get(artId).getColumnContentModelId(); + String columnContentModelId = articleIdList.get(artId).getMdiyModelId(); // 文章是否已经生成了,生成了就跳过 if (generateIds.contains(articleId)) { artId++; @@ -225,20 +228,20 @@ public class CmsParserUtil extends ParserUtil { // 组合文章路径如:html/站点id/栏目id/文章id.html writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + articleId); //如果是封面就生成index.html - if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { + if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { writePath = ParserUtil.buildHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX); } Map parserParams = new HashMap(); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); // 判断当前栏目是否有自定义模型 - if (columnContentModelId > 0) { + if (StringUtils.isNotBlank(columnContentModelId)) { // 通过当前栏目的模型编号获取,自定义模型表名 if (contentModelMap.containsKey(columnContentModelId)) { parserParams.put(TABLE_NAME, contentModel.getCmTableName()); } else { // 通过栏目模型编号获取自定义模型实体 contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) - .getEntity(columnContentModelId); + .getEntity(Integer.parseInt(columnContentModelId)); // 将自定义模型编号设置为key值 contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); parserParams.put(TABLE_NAME, contentModel.getCmTableName()); @@ -265,13 +268,13 @@ public class CmsParserUtil extends ParserUtil { parserParams.put(IS_DO, false); parserParams.put(ParserUtil.PAGE, page); - String content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, false); + String content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, false); FileUtil.writeString(content, writePath, Const.UTF8); // 手机端 if (ParserUtil.hasMobileFile(columnUrl)) { writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + articleId); //如果是封面就生成index.html - if(articleIdList.get(artId).getColumnType() == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { + if(Integer.parseInt(articleIdList.get(artId).getCategoryType()) == ColumnTypeEnum.COLUMN_TYPE_COVER.toInt()) { writePath = ParserUtil.buildMobileHtmlPath(articleColumnPath + File.separator + ParserUtil.INDEX); } // 判断文件是否存在,若不存在弹出返回信息 @@ -280,7 +283,7 @@ public class CmsParserUtil extends ParserUtil { continue; } parserParams.put(MOBILE, BasicUtil.getApp().getAppMobileStyle()); - content = CmsParserUtil.generate(articleIdList.get(artId).getColumnUrl(), parserParams, true); + content = CmsParserUtil.generate(articleIdList.get(artId).getCategoryUrl(), parserParams, true); FileUtil.writeString(content, writePath, Const.UTF8); } artId++; diff --git a/src/main/webapp/static/plugins/tree-select/tree.js b/src/main/webapp/static/plugins/tree-select/tree.js index 113df1dc..7ef762ae 100644 --- a/src/main/webapp/static/plugins/tree-select/tree.js +++ b/src/main/webapp/static/plugins/tree-select/tree.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.treeSelect=t():e.treeSelect=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){e.exports=!n(6)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(14),i=(r=o)&&r.__esModule?r:{default:r};t.default=(0,i.default)({template:"#tree-select",name:"el-tree-select",props:{props:{type:Object,default:function(){return{value:"id",label:"title",children:"children"}}},options:{type:Array,default:function(){return[]}},value:{type:Number,default:function(){return null}},clearable:{type:Boolean,default:function(){return!0}},accordion:{type:Boolean,default:function(){return!1}}},watch:{value:function(e,t){this.valueId=e,this.initHandle()},options:{handler:function(e,t){console.log(this.valueId,e),this.initHandle()},immediate:!0,deep:!0}},data:function(){return{valueId:this.value,valueTitle:"",defaultExpandedKey:[]}},mounted:function(){this.initHandle()},methods:{initHandle:function(){if(this.valueId){if(!this.$refs.selectTree.getNode(this.valueId))return;this.valueTitle=this.$refs.selectTree.getNode(this.valueId).data[this.props.label],this.$refs.selectTree.setCurrentKey(this.valueId),this.defaultExpandedKey=[this.valueId]}this.initScroll()},initScroll:function(){this.$nextTick(function(){var e=document.querySelectorAll(".el-scrollbar .el-select-dropdown__wrap")[0],t=document.querySelectorAll(".el-scrollbar .el-scrollbar__bar");e.style.cssText="margin: 0px; max-height: none; overflow: hidden;",t.forEach(function(e){return e.style.width=0})})},handleNodeClick:function(e){this.$emit("input",e[this.props.value]),this.$emit("change",{node:e,dom:this.$refs.tsSselect}),this.$refs.tsSselect.blur(),this.defaultExpandedKey=[]},clearHandle:function(){this.valueTitle="",this.valueId=null,this.defaultExpandedKey=[],this.clearSelected(),this.$emit("change",null)},clearSelected:function(){document.querySelectorAll("#tree-option .el-tree-node").forEach(function(e){return e.classList.remove("is-current")})}}},"watch",{value:function(){this.valueId=this.value,0===this.value&&(this.valueTitle="顶级菜单"),this.initHandle()}})},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(22),o=n(23),i=n(25),a=Object.defineProperty;t.f=n(0)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n.n(r);for(var i in r)"default"!==i&&function(e){n.d(t,e,function(){return r[e]})}(i);var a=n(28),u=!1;var l=function(e){u||n(8)},c=n(13)(o.a,a.a,!1,l,"data-v-24dbbcae",null);c.options.__file="src/components/tree.vue",t.default=c.exports},function(e,t,n){var r=n(9);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(11)("682353eb",r,!1,{})},function(e,t,n){(e.exports=n(10)(void 0)).push([e.i,"\n.el-scrollbar .el-scrollbar__view .el-select-dropdown__item[data-v-24dbbcae] {\r\n height: auto;\r\n max-height: 274px;\r\n padding: 0;\r\n overflow: hidden;\r\n overflow-y: auto;\n}\n.el-select-dropdown__item.selected[data-v-24dbbcae] {\r\n font-weight: normal;\n}\nul li[data-v-24dbbcae] .el-tree .el-tree-node__content {\r\n height: auto;\r\n padding: 0 20px;\n}\n.el-tree-node__label[data-v-24dbbcae] {\r\n font-weight: normal;\n}\n.el-tree[data-v-24dbbcae] .is-current .el-tree-node__label {\r\n color: #409eff;\r\n font-weight: 700;\n}\n.el-tree[data-v-24dbbcae] .is-current .el-tree-node__children .el-tree-node__label {\r\n color: #606266;\r\n font-weight: normal;\n}\r\n",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+new Buffer(JSON.stringify(a)).toString("base64")+" */"),i=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var a=[];for(o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var a=[];for(o=0;o - - - <#include "head-file.htm"> - - - - - - - - <#include "head.htm"> - -
- -
-
-
- -
-
-
- - -
-
- -
-
-
-
-
-
-
-
-
网站案例
-
- MORE>> -
-
-
- {ms:arclist typeid=149 size=6} -
-
- -
-
-
[field.title/]
-
- -

- [field.content/] -

-
- -
-
- {/ms:arclist} -
-
-
-
-
-
-
产品方向
-
-
-
    -
  • -
    - - -
    -
    - -
    纯Java开发,MCMS支持PC与MOBILE皮肤定制,同时使用MS团队移动JS插件,支持站群。
    -
  • -
  • -
    - - -
    -
    - -
    重新定义移动开发,快速、开放、高性能,数据无缝对接,超过500个模块api 接口,方便实现各种应用。
    -
  • -
  • -
    - - -
    -
    - -
    MS+物联网,让生产企业真正掌握企业命脉,实现互联网+生产,给企业插上信息化翅膀,共享、共荣大数据时代
    -
  • -
-
-
-
-
-
-
-
公司动态
-
- MORE>> -
-
-
- {ms:arclist typeid=59 size=1} - - {/ms:arclist} - -
-
-
-
-
- <#include "footer.htm"> - - - \ No newline at end of file +{ms:channel ref=one} +[field.typetitle/] + {ms:arclist refs=one} + [field.title/]
+ [field.author/]
+ {/ms:arclist} +{/ms:channel} \ No newline at end of file