build: continew-starter 2.13.0 => 2.13.1

1.DataPermissionUserContextProvider 相关命名调整,以避免和 Admin 内类名冲突
DataPermissionUserContextProvider => DataPermissionUserDataProvider
UserContext => UserData
RoleContext => RoleData
2.引入 crane4j 依赖及填充处理(Starter 为了扩展性,移除了此依赖及相关处理)
3.API 替换
3.1SpringUtil.getBean(TenantHandler.class) => TenantUtils
3.2JakartaServletUtil.write => ServletUtils.writeJSON
3.3tenantExtensionProperties.isEnabled() => TenantContextHolder.isTenantEnabled()
4.Starter 内部修复
4.1FastExcel POI 版本冲突导致的导出报错
4.2EnumValue 校验支持了 BaseEnum
This commit is contained in:
2025-07-17 22:29:09 +08:00
parent 7e9a950694
commit 6136797588
16 changed files with 72 additions and 59 deletions

View File

@@ -23,7 +23,6 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpStatus;
import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor;
@@ -42,8 +41,8 @@ import top.continew.admin.system.service.UserService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.StrUtils;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.context.TenantContextHolder;
import top.continew.starter.extension.tenant.util.TenantUtils;
import top.continew.starter.log.dao.LogDao;
import top.continew.starter.log.model.LogRecord;
import top.continew.starter.log.model.LogRequest;
@@ -89,7 +88,7 @@ public class LogDaoLocalImpl implements LogDao {
// 设置操作人
this.setCreateUser(logDO, logRequest, logResponse);
Long tenantId = TenantContextHolder.getTenantId();
SpringUtil.getBean(TenantHandler.class).execute(tenantId, () -> logMapper.insert(logDO));
TenantUtils.execute(tenantId, () -> logMapper.insert(logDO));
}
/**

View File

@@ -19,16 +19,14 @@ package top.continew.admin.config.satoken;
import cn.dev33.satoken.fun.SaParamFunction;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.extra.servlet.JakartaServletUtil;
import cn.hutool.json.JSONUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.lang.Nullable;
import top.continew.admin.common.context.UserContext;
import top.continew.admin.common.context.UserContextHolder;
import top.continew.starter.core.util.ServletUtils;
import top.continew.starter.extension.tenant.context.TenantContextHolder;
import top.continew.starter.web.model.R;
@@ -59,12 +57,13 @@ public class SaExtensionInterceptor extends SaInterceptor {
return true;
}
// 检查用户租户权限
Long userTenantId = userContext.getTenantId();
Long tenantId = TenantContextHolder.getTenantId();
if (!userTenantId.equals(tenantId)) {
JakartaServletUtil.write(response, JSONUtil.toJsonStr(R.fail(String.valueOf(HttpStatus.FORBIDDEN
.value()), "您当前没有访问该租户的权限")), MediaType.APPLICATION_JSON_VALUE);
return false;
if (TenantContextHolder.isTenantEnabled()) {
Long userTenantId = userContext.getTenantId();
Long tenantId = TenantContextHolder.getTenantId();
if (!userTenantId.equals(tenantId)) {
ServletUtils.writeJSON(response, R.fail(String.valueOf(HttpStatus.FORBIDDEN.value()), "您当前没有访问该租户的权限"));
return false;
}
}
UserContextHolder.getExtraContext();
return true;

View File

@@ -7,7 +7,7 @@ application:
description: 持续迭代优化的前后端分离中后台管理系统框架,开箱即用,持续提供舒适的开发体验。
# 版本
version: 4.0.0-SNAPSHOT
starter: 2.13.0
starter: 2.13.1
# 基本包
base-package: top.continew.admin
## 作者信息配置