diff --git a/pom.xml b/pom.xml index fd415c9b..99745fd2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,52 +3,23 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - org.springframework.boot - spring-boot-starter-parent - 2.2.2.RELEASE + net.mingsoft + ms-pom + 2.0.0-SNAPSHOT 4.0.0 net.mingsoft mcms - 5.0.0 + 5.1-SNAPSHOT ms-mcms 1.8 - - - sonatype-nexus-snapshots - Sonatype Nexus Snapshots - http://repo1.maven.org/maven2/ - - true - - - true - - - - sonatype - Sonatype Snapshots - https://oss.sonatype.org/content/groups/public/ - - true - - - true - - - + net.mingsoft ms-mpeople - 1.0.24 - - - net.mingsoft - ms-basic - 1.0.30-SNAPSHOT diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index 5e50e276..266f69c9 100644 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -36,6 +36,7 @@ import net.mingsoft.cms.util.CmsParserUtil; import net.mingsoft.mdiy.bean.AttributeBean; import net.mingsoft.mdiy.bean.PageBean; import net.mingsoft.mdiy.util.ParserUtil; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -173,27 +174,30 @@ public class GeneraterAction extends BaseAction { // 1、设置模板文件夹路径 // 获取栏目列表模版 for (CategoryEntity column : columns) { - // 判断模板文件是否存在 - if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryUrl()))) { - LOG.error("模板不存在:{}",column.getCategoryUrl()); - continue; - } - //获取模板中列表标签中的条件 - Map map = new HashMap<>(); - map.put(ParserUtil.APP_ID, BasicUtil.getAppId()); - PageBean page = new PageBean(); - map.put(ParserUtil.HTML, ParserUtil.HTML); - map.put(ParserUtil.URL, BasicUtil.getUrl()); - map.put(ParserUtil.PAGE, page); ContentBean contentBean = new ContentBean(); contentBean.setContentCategoryId(column.getId()); - AttributeBean attributeBean = new AttributeBean(); - // 获取文章列表模板标签属性 - ParserUtil.read(column.getCategoryListUrl(),map, page,attributeBean); - contentBean.setFlag(attributeBean.getFlag()); - contentBean.setNoflag(attributeBean.getNoflag()); - contentBean.setOrder(attributeBean.getOrder()); - contentBean.setOrderBy(attributeBean.getOrderby()); + // 分类是列表,链接 + if(!column.getCategoryType().equals("2")) { + // 判断模板文件是否存在 + if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryListUrl()))) { + LOG.error("模板不存在:{}", column.getCategoryUrl()); + continue; + } + //获取模板中列表标签中的条件 + Map map = new HashMap<>(); + map.put(ParserUtil.APP_ID, BasicUtil.getAppId()); + PageBean page = new PageBean(); + map.put(ParserUtil.HTML, ParserUtil.HTML); + map.put(ParserUtil.URL, BasicUtil.getUrl()); + map.put(ParserUtil.PAGE, page); + AttributeBean attributeBean = new AttributeBean(); + // 获取文章列表模板标签属性 + ParserUtil.read(column.getCategoryListUrl(), map, page, attributeBean); + contentBean.setFlag(attributeBean.getFlag()); + contentBean.setNoflag(attributeBean.getNoflag()); + contentBean.setOrder(attributeBean.getOrder()); + contentBean.setOrderBy(attributeBean.getOrderby()); + } articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean); // 判断列表类型 switch (column.getCategoryType()) { @@ -249,17 +253,20 @@ public class GeneraterAction extends BaseAction { categoryList = categoryBiz.query(categoryEntity); for(CategoryEntity category : categoryList){ contentBean.setContentCategoryId(category.getId()); - // 判断模板文件是否存在 - if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryUrl()))) { - LOG.error("模板不存在:{}",category.getCategoryUrl()); - continue; + // 分类是列表,链接 + if(!category.getCategoryType().equals("2")){ + // 判断模板文件是否存在 + if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) { + LOG.error("模板不存在:{}",category.getCategoryUrl()); + continue; + } + // 获取文章列表表属性 + ParserUtil.read(category.getCategoryListUrl(),map, page,attributeBean); + contentBean.setFlag(attributeBean.getFlag()); + contentBean.setNoflag(attributeBean.getNoflag()); + contentBean.setOrder(attributeBean.getOrder()); + contentBean.setOrderBy(attributeBean.getOrderby()); } - // 获取文章列表表属性 - ParserUtil.read(category.getCategoryListUrl(),map, page,attributeBean); - contentBean.setFlag(attributeBean.getFlag()); - contentBean.setNoflag(attributeBean.getNoflag()); - contentBean.setOrder(attributeBean.getOrder()); - contentBean.setOrderBy(attributeBean.getOrderby()); articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean); // 有符合条件的就更新 if (articleIdList.size() > 0) { @@ -268,18 +275,21 @@ public class GeneraterAction extends BaseAction { } }else { CategoryEntity category = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(columnId)); - // 获取文章列表表属性 - // 判断模板文件是否存在 - if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryUrl()))) { - LOG.error("模板不存在:{}",category.getCategoryUrl()); - return; - } - ParserUtil.read(category.getCategoryListUrl(),map, page,attributeBean); - contentBean.setFlag(attributeBean.getFlag()); - contentBean.setNoflag(attributeBean.getNoflag()); - contentBean.setOrder(attributeBean.getOrder()); - contentBean.setOrderBy(attributeBean.getOrderby()); contentBean.setContentCategoryId(columnId); + // 分类是列表,链接 + if(!category.getCategoryType().equals("2")){ + // 获取文章列表表属性 + // 判断模板文件是否存在 + if (!FileUtil.exist(ParserUtil.buildTempletPath(category.getCategoryUrl()))) { + LOG.error("模板不存在:{}",category.getCategoryUrl()); + return; + } + ParserUtil.read(category.getCategoryListUrl(),map, page,attributeBean); + contentBean.setFlag(attributeBean.getFlag()); + contentBean.setNoflag(attributeBean.getNoflag()); + contentBean.setOrder(attributeBean.getOrder()); + contentBean.setOrderBy(attributeBean.getOrderby()); + } articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean); // 有符合条件的就更新 if (articleIdList.size() > 0) { diff --git a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml index 4059209e..1c572037 100644 --- a/src/main/java/net/mingsoft/cms/dao/IContentDao.xml +++ b/src/main/java/net/mingsoft/cms/dao/IContentDao.xml @@ -276,10 +276,20 @@ and (cms_content.content_type not in ( #{noflag} ) or cms_content.content_type is null) - ORDER BY ${orderBy} - - ${order} + ORDER BY content_datetime + ORDER BY content_hit + ORDER BY content_sort + + ORDER BY cms_content.id + + + ${order} + + + desc + +