Merge remote-tracking branch 'origin/master'

This commit is contained in:
wujj 2020-11-21 12:44:26 +08:00
commit 6a7d9d113f
4 changed files with 21 additions and 32 deletions

View File

@ -252,17 +252,17 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
categoryParentId += ','+articleIdList.get(artId).getCategoryParentId(); categoryParentId += ','+articleIdList.get(artId).getCategoryParentId();
} }
// 文章的栏目模型编号 // 文章的栏目模型编号
String columnContentModelId = articleIdList.get(artId).getMdiyModelId(); Integer columnContentModelId = articleIdList.get(artId).getMdiyModelId();
Map<String, Object> parserParams = new HashMap<String, Object>(); Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if ( StringUtils.isNotBlank(columnContentModelId) && Integer.parseInt(columnContentModelId)>0) { if ( columnContentModelId != null && columnContentModelId > 0) {
// 通过当前栏目的模型编号获取自定义模型表名 // 通过当前栏目的模型编号获取自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) { if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
} else { } else {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel=(ModelEntity)modelBiz.getEntity(Integer.parseInt(columnContentModelId)); contentModel=(ModelEntity)modelBiz.getEntity(columnContentModelId);
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getModelTableName()); contentModelMap.put(columnContentModelId, contentModel.getModelTableName());
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
@ -330,7 +330,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+"")); column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+""));
// 获取表单类型的id // 获取表单类型的id
if (column != null&&ObjectUtil.isNotNull(column.getMdiyModelId())) { if (column != null&&ObjectUtil.isNotNull(column.getMdiyModelId())) {
contentModel = (ModelEntity) modelBiz.getEntity(Integer.parseInt(column.getMdiyModelId())); contentModel = (ModelEntity) modelBiz.getEntity(column.getMdiyModelId());
if (contentModel != null) { if (contentModel != null) {
Map<String,String> fieldMap = contentModel.getFieldMap(); Map<String,String> fieldMap = contentModel.getFieldMap();
for (String s : fieldMap.keySet()) { for (String s : fieldMap.keySet()) {

View File

@ -146,15 +146,6 @@
</where> </where>
limit 0,1 limit 0,1
</select> </select>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${id}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${id}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${id}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 模糊查询开始 --> <!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap"> <select id="queryChildren" resultMap="resultMap">
@ -170,7 +161,7 @@
find_in_set(#{categoryParentId},CATEGORY_PARENT_ID) find_in_set(#{categoryParentId},CATEGORY_PARENT_ID)
</if> </if>
<if test="categoryParentId == null or categoryParentId ==''"> <if test="categoryParentId == null or categoryParentId ==''">
<include refid="queryWhereCategoryId"></include> find_in_set('${id}',CATEGORY_PARENT_ID)
</if> </if>
<if test="id != null"> <if test="id != null">
or id=#{id} or id=#{id}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -34,6 +35,7 @@ private static final long serialVersionUID = 1574925152750L;
/** /**
* 所属栏目 * 所属栏目
*/ */
@TableField(insertStrategy = FieldStrategy.NOT_EMPTY, updateStrategy = FieldStrategy.NOT_EMPTY, whereStrategy = FieldStrategy.NOT_EMPTY)
private String categoryId; private String categoryId;
/** /**
* 栏目管理属性 * 栏目管理属性
@ -70,7 +72,7 @@ private static final long serialVersionUID = 1574925152750L;
/** /**
* 栏目管理的内容模型id * 栏目管理的内容模型id
*/ */
private String mdiyModelId; private Integer mdiyModelId;
/** /**
* 类别发布时间 * 类别发布时间
*/ */
@ -260,19 +262,15 @@ private static final long serialVersionUID = 1574925152750L;
public String getCategoryDiyUrl() { public String getCategoryDiyUrl() {
return this.categoryDiyUrl; return this.categoryDiyUrl;
} }
/**
* 设置栏目管理的内容模型id public Integer getMdiyModelId() {
*/ return mdiyModelId;
public void setMdiyModelId(String mdiyModelId) { }
public void setMdiyModelId(Integer mdiyModelId) {
this.mdiyModelId = mdiyModelId; this.mdiyModelId = mdiyModelId;
} }
/**
* 获取栏目管理的内容模型id
*/
public String getMdiyModelId() {
return this.mdiyModelId;
}
/** /**
* 设置类别发布时间 * 设置类别发布时间
*/ */

View File

@ -72,7 +72,7 @@ public class CmsParserUtil extends ParserUtil {
throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException { throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
try{ try{
// 文章的栏目模型编号 // 文章的栏目模型编号
String columnContentModelId = column.getMdiyModelId(); Integer columnContentModelId = column.getMdiyModelId();
PageBean page = new PageBean(); PageBean page = new PageBean();
page.setSize(10); page.setSize(10);
//获取分页数量 //获取分页数量
@ -83,9 +83,9 @@ public class CmsParserUtil extends ParserUtil {
String columnListPath; String columnListPath;
ModelEntity contentModel = null; ModelEntity contentModel = null;
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (StringUtils.isNotBlank(columnContentModelId)) { if (columnContentModelId != null) {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId)); contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(columnContentModelId);
} }
int pageNo = 1; int pageNo = 1;
@ -181,8 +181,8 @@ public class CmsParserUtil extends ParserUtil {
// 文章的模板路径 // 文章的模板路径
String columnUrl = articleIdList.get(artId).getCategoryUrl(); String columnUrl = articleIdList.get(artId).getCategoryUrl();
// 文章的栏目模型编号 // 文章的栏目模型编号
String columnContentModelId = ""; Integer columnContentModelId = null;
if(StringUtils.isNotBlank(articleIdList.get(artId).getMdiyModelId()) && Integer.parseInt(articleIdList.get(artId).getMdiyModelId())>0){ if(articleIdList.get(artId).getMdiyModelId() != null && articleIdList.get(artId).getMdiyModelId() > 0){
columnContentModelId = articleIdList.get(artId).getMdiyModelId(); columnContentModelId = articleIdList.get(artId).getMdiyModelId();
} }
// 文章是否已经生成了生成了就跳过 // 文章是否已经生成了生成了就跳过
@ -208,14 +208,14 @@ public class CmsParserUtil extends ParserUtil {
Map<String, Object> parserParams = new HashMap<String, Object>(); Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (StringUtils.isNotBlank(columnContentModelId)) { if (columnContentModelId != null) {
// 通过当前栏目的模型编号获取自定义模型表名 // 通过当前栏目的模型编号获取自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) { if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(TABLE_NAME, contentModel.getModelTableName()); parserParams.put(TABLE_NAME, contentModel.getModelTableName());
} else { } else {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ModelEntity) SpringUtil.getBean(IModelBiz.class) contentModel = (ModelEntity) SpringUtil.getBean(IModelBiz.class)
.getEntity(Integer.parseInt(columnContentModelId)); .getEntity(columnContentModelId);
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getModelTableName()); contentModelMap.put(columnContentModelId, contentModel.getModelTableName());
parserParams.put(TABLE_NAME, contentModel.getModelTableName()); parserParams.put(TABLE_NAME, contentModel.getModelTableName());