zss
2025-02-17 087991c76f078defe5eb55d84223021b4199fb3d
framework/src/main/java/com/yuanchu/mom/config/PowerConfig.java
@@ -4,6 +4,7 @@
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.annotation.ValueClassify;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.exception.MyFileException;
import com.yuanchu.mom.mapper.AuthMapper;
@@ -42,6 +43,11 @@
            Integer userId = Integer.parseInt(obj.get("id") + "");
            int i = authMapper.isPower(userId, h.getMethod().getName());
            if (i == 0){
                // 判断是否有权限注解
                ValueClassify valueClassify = h.getMethodAnnotation(ValueClassify.class);
                if (valueClassify == null) {
                    return HandlerInterceptor.super.preHandle(request, response, handler);
                }
                throw new ErrorException(obj.get("name") + " 无权限访问 " + h.getMethod().getName() + " 接口");
            }
        }