| | |
| | | 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; |
| | |
| | | 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() + " 接口"); |
| | | } |
| | | } |