Bladeren bron

1、更改find_in_set使用方法
2、为菜单、角色添加mybatis-plus适配
3、优化添加菜单服务器返回信息

xierz 4 jaren geleden
bovenliggende
commit
f01ab0deda

+ 1 - 0
src/main/java/net/mingsoft/cms/action/ContentAction.java

@@ -20,6 +20,7 @@
  */
 package net.mingsoft.cms.action;
 
+import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;

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

@@ -157,10 +157,10 @@
 			and
 			(
 			<if test="categoryParentIds != null and categoryParentIds!=''">
-				find_in_set(#{categoryParentIds},CATEGORY_PARENT_IDS)
+				find_in_set(#{categoryParentIds},CATEGORY_PARENT_IDS)>0
 			</if>
 			<if test="categoryParentIds == null or  categoryParentIds ==''">
-				find_in_set('${id}',CATEGORY_PARENT_IDS)
+				find_in_set('${id}',CATEGORY_PARENT_IDS)>0
 			</if>
 			<if test="id != null">
 				or id=#{id}
@@ -208,7 +208,7 @@
 			<if test="dictId != null"> and dict_id=#{dictId} </if>
 			<if test="categoryFlag != null and categoryFlag != ''"> and category_flag=#{categoryFlag}</if>
 			<if test="categoryPath != null and categoryPath != ''"> and category_path=#{categoryPath}</if>
-			<if test="categoryParentIds != null and categoryParentIds != ''"> and  find_in_set(#{categoryParentIds},category_parent_ids)</if>
+			<if test="categoryParentIds != null and categoryParentIds != ''"> and  find_in_set(#{categoryParentIds},category_parent_ids)>0</if>
 			<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
 			<if test="createDate != null"> and create_date=#{createDate} </if>
 			<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>

+ 4 - 4
src/main/java/net/mingsoft/cms/dao/IContentDao.xml

@@ -218,7 +218,7 @@
 			ct.del=0
 			<if test="contentTitle != null and contentTitle != ''"> and  content_title like CONCAT('%',#{contentTitle},'%')</if>
 			<if test="categoryId != null and categoryId != ''"> 	and (ct.category_id=#{categoryId} or ct.category_id in
-				(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)))</if>
+				(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)>0))</if>
 			<if test="contentType != null and contentType != ''"> and content_type LIKE CONCAT('%',#{contentType},'%')</if>
 			<if test="contentDisplay != null and contentDisplay != ''"> and content_display=#{contentDisplay}</if>
 			<if test="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if>
@@ -250,7 +250,7 @@
 			<!-- 查询子栏目数据 -->
 			<if test="categoryId &gt; 0">
 				and (ct.category_id=#{categoryId} or ct.category_id in
-				(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)))
+				(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)>0))
 			</if>
 			<if test="beginTime!=null and beginTime!=''">
 				and content_datetime &gt;= #{beginTime}
@@ -293,7 +293,7 @@
 		<where>
 			a.del=0
 			<if test="ids!=null and ids!=''">
-				and FIND_IN_SET(a.category_id,#{ids})
+				and FIND_IN_SET(a.category_id,#{ids})>0
 			</if>
 			<if test="map.content_title!=null">
 			and a.content_title like CONCAT("%",#{map.content_title},"%")
@@ -306,7 +306,7 @@
 			</if>
 			<if test="map.content_type!=null">
 				and <foreach item="item" index="index" collection="map.content_type.split(',')"  open="(" separator="or" close=")">
-					FIND_IN_SET('${item}',a.content_type)
+					FIND_IN_SET('${item}',a.content_type)>0
 				</foreach>
 			</if>
 			<if test="map.content_description!=null">