Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

wujj 5 tahun lalu
induk
melakukan
6a7d9d113f

+ 4 - 4
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java

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

+ 1 - 10
src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml

@@ -146,15 +146,6 @@
 			</where>
 			limit 0,1
 		</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">
@@ -170,7 +161,7 @@
 				find_in_set(#{categoryParentId},CATEGORY_PARENT_ID)
 			</if>
 			<if test="categoryParentId == null or  categoryParentId ==''">
-				<include refid="queryWhereCategoryId"></include>
+				find_in_set('${id}',CATEGORY_PARENT_ID)
 			</if>
 			<if test="id != null">
 				or id=#{id}

+ 9 - 11
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java

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

+ 7 - 7
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java

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