From ce10da906c58596fce43bffa6a6d177268ca177b Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期二, 30 四月 2024 00:54:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- framework/src/main/java/com/yuanchu/mom/common/AllController.java | 46 +++++++++++++++++++++++++++++++--------------- 1 files changed, 31 insertions(+), 15 deletions(-) diff --git a/framework/src/main/java/com/yuanchu/mom/common/AllController.java b/framework/src/main/java/com/yuanchu/mom/common/AllController.java index 10176fc..89a1ecd 100644 --- a/framework/src/main/java/com/yuanchu/mom/common/AllController.java +++ b/framework/src/main/java/com/yuanchu/mom/common/AllController.java @@ -1,8 +1,10 @@ package com.yuanchu.mom.common; import com.yuanchu.mom.annotation.ValueAuth; +import com.yuanchu.mom.annotation.ValueClassify; import com.yuanchu.mom.mapper.AuthMapper; import io.swagger.annotations.ApiOperation; +import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.method.HandlerMethod; @@ -11,6 +13,7 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; +import java.lang.reflect.Method; import java.util.Map; @Component @@ -28,26 +31,39 @@ for (HandlerMethod value : methodMap.values()) { ApiOperation annotation = value.getMethodAnnotation(ApiOperation.class); ValueAuth valueAuth = value.getMethodAnnotation(ValueAuth.class); - if (valueAuth==null){ - if (annotation != null) { + ValueClassify valueClassify = value.getMethodAnnotation(ValueClassify.class); + if (valueAuth == null) { + if (valueClassify !=null) { + String type = valueClassify.value(); String remark = annotation.value(); - String type = "淇敼"; - if (remark.contains("鑾峰彇")||remark.contains("鏌ヨ")){ - type = "鏌ヨ"; - } else if(remark.contains("鍒犻櫎")){ - type = "鍒犻櫎"; - } else if(remark.contains("娣诲姞")||remark.contains("鏂板")){ - type = "娣诲姞"; - } - try { - authMapper.insertPower(value.getMethod().getName(), remark, type); - }catch (Exception e){ - System.err.println(value.getMethod()); + authMapper.insertPower(value.getMethod().getName(),remark,type); + }else{ + if (annotation != null) { + String remark = annotation.value(); + String type = "淇敼"; + if (remark.contains("鑾峰彇") || remark.contains("鏌ヨ")) { + type = "鏌ヨ"; + } else if (remark.contains("鍒犻櫎")) { + type = "鍒犻櫎"; + } else if (remark.contains("娣诲姞") || remark.contains("鏂板") || remark.contains("璁ら")) { + type = "娣诲姞"; + } else if (remark.contains("瀵煎叆")) { + type = "瀵煎叆"; + } else if (remark.contains("瀵煎嚭")) { + type = "瀵煎嚭"; + } + try { + authMapper.insertPower(value.getMethod().getName(), remark, type); + } catch (Exception e) { + System.err.println(value.getMethod()); + e.printStackTrace(); + } } } + } } + System.out.println("********************鏉冮檺鑿滃崟瀹屾垚********************"); } - } @PostConstruct public void pingStart() { -- Gitblit v1.9.3