Browse Source

快捷菜单与日程计划

chenc 3 years ago
parent
commit
b33dd5e440

+ 1 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/mapper/xml/CdScheduleMapper.xml

@@ -19,7 +19,7 @@
         </if>
     </select>
 
-    <select id="getLastMonth" parameterType="org.jeecg.modules.oa.entity.CdSchedule">
+    <select id="getLastMonth" parameterType="org.jeecg.modules.oa.entity.CdSchedule" resultType="java.lang.Integer">
         select count(*) from cd_schedule where del_flag='0' AND pk_org=#{cdSchedule.pkOrg}
         <if test="cdSchedule.whereTimeType=='1'">
             AND PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( start_time, '%Y%m' ) ) =1

+ 17 - 5
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresRoles;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -279,10 +280,13 @@ public class SysPermissionController {
 					List<Map<String,Object>> mapListChild=new ArrayList<>();
 					//获取对应子集菜单
 					if(menujsonArray.getJSONObject(i).getJSONArray("children")!=null){
-						getChildList(mapListChild,menujsonArray.getJSONObject(i).getJSONArray("children"));
+						getChildList(name,mapListChild,menujsonArray.getJSONObject(i).getJSONArray("children"));
 					}
 					map.put("childList",mapListChild);
-					mapList.add(map);
+					//子菜单为空的则过滤掉
+					if(mapListChild!=null&&mapListChild.size()>0){
+						mapList.add(map);
+					}
 				}
 			}
 			//路由菜单
@@ -297,17 +301,25 @@ public class SysPermissionController {
 	}
 
 	//查询顶级菜单下所有的子菜单
-	public void getChildList(List<Map<String,Object>> mapListChild,JSONArray jsonArray){
+	public void getChildList(String name,List<Map<String,Object>> mapListChild,JSONArray jsonArray){
 		for(int i=0;i<jsonArray.size();i++){
 			if(jsonArray.getJSONObject(i).getJSONArray("children")!=null){
-				getChildList(mapListChild,jsonArray.getJSONObject(i).getJSONArray("children"));
+				getChildList(name,mapListChild,jsonArray.getJSONObject(i).getJSONArray("children"));
 			}else{
+				String titleName=jsonArray.getJSONObject(i).getJSONObject("meta").get("title").toString();
 				Map<String,Object> map=new LinkedHashMap<>();
 				map.put("name",jsonArray.getJSONObject(i).getJSONObject("meta").get("title"));
 				map.put("sysPermissionId",jsonArray.getJSONObject(i).get("id"));
 				map.put("path",jsonArray.getJSONObject(i).get("path"));
 				map.put("id",jsonArray.getJSONObject(i).get("id"));
-				mapListChild.add(map);
+				//判断是否根据菜单名称匹配
+				if(StringUtils.isNotBlank(name)){
+					if(StringUtils.isNotBlank(titleName)&&titleName.indexOf(name)!=-1){
+						mapListChild.add(map);
+					}
+				}else{
+					mapListChild.add(map);
+				}
 			}
 		}
 	}

+ 6 - 6
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysPermissionMapper.xml

@@ -89,9 +89,9 @@
 		or (p.url = '/online') )
 		<!--update end Author:taoyan  Date:20200213 for:默认授权online的auto动态隐藏路由  -->
 		and p.del_flag = 0
-		<if test="name!=null and name !=''">
-			p.name like #{name,jdbcType=VARCHAR}
-		</if>
+		<!--<if test="name!=null and name !=''">
+            and (p.name like concat('%',#{name,jdbcType=VARCHAR},'%') or (p.parent_id is null or p.parent_id =''))
+		</if>-->
 		<!--update begin Author:lvdandan  Date:20200225 for:加入部门权限 -->
 		UNION
 		SELECT p.*
@@ -105,9 +105,9 @@
 		)
 		and p.del_flag = 0
 
-		<if test="name!=null and name !=''">
-			p.name like #{name,jdbcType=VARCHAR}
-		</if>
+		<!--<if test="name!=null and name !=''">
+            and (p.name like concat('%',#{name,jdbcType=VARCHAR},'%') or (p.parent_id is null or p.parent_id =''))
+		</if>-->
 		<!--update end Author:lvdandan  Date:20200213 for:加入部门权限 -->
 		) h order by h.sort_no ASC
 	</select>