前端代码 和 权限校验

This commit is contained in:
liumengyu
2026-08-21 17:46:50 +08:00
parent 179b12e3bf
commit 8312231af5
11 changed files with 201 additions and 93 deletions
@@ -1,6 +1,7 @@
package com.roomroot.jwgl.config;
import com.roomroot.jwgl.interceptor.AccountManagementAuthorizationInterceptor;
import com.roomroot.jwgl.interceptor.JwglApiAccessInterceptor;
import com.roomroot.jwgl.interceptor.OperationLogInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@@ -26,21 +27,27 @@ public class AccountManagementWebMvcConfig implements WebMvcConfigurer {
*/
private final OperationLogInterceptor operationLogInterceptor;
private final JwglApiAccessInterceptor jwglApiAccessInterceptor;
/**
* 构造账户管理和操作日志统一 Web MVC 配置。
*
* @param authorizationInterceptor 账户管理身份和权限拦截器
* @param operationLogInterceptor 操作日志统一请求采集拦截器
* @param jwglApiAccessInterceptor 教务角色接口访问拦截器
*/
public AccountManagementWebMvcConfig(
AccountManagementAuthorizationInterceptor
authorizationInterceptor,
OperationLogInterceptor operationLogInterceptor) {
OperationLogInterceptor operationLogInterceptor,
JwglApiAccessInterceptor jwglApiAccessInterceptor) {
// 第一步:保存账户管理专用拦截器,供 MVC 注册阶段使用。
this.authorizationInterceptor = authorizationInterceptor;
// 第二步:保存操作日志采集拦截器,供 MVC 注册阶段使用。
this.operationLogInterceptor = operationLogInterceptor;
this.jwglApiAccessInterceptor = jwglApiAccessInterceptor;
}
/**
@@ -65,6 +72,17 @@ public class AccountManagementWebMvcConfig implements WebMvcConfigurer {
* 第五步:覆盖全部 Controller 请求,由采集拦截器自行跳过
* 非 Controller 处理器和没有有效登录记录的请求。
*/
registry.addInterceptor(jwglApiAccessInterceptor)
.addPathPatterns("/**")
.excludePathPatterns(
"/login",
"/register",
"/captchaImage",
"/jys/teacher/list",
"/swagger-ui/**",
"/v3/api-docs/**",
"/druid/**");
registry.addInterceptor(operationLogInterceptor)
.addPathPatterns("/**");
}