mirror of
https://gitee.com/myxzgzs/boyue-vue-pro.git
synced 2025-08-08 00:12:46 +08:00
fix:【SYSTEM 系统管理】修复 DefaultDBFieldHandler 在 Async 情况下,无法获取到 getLoginUserId 的问题
This commit is contained in:
parent
7a5e28d08a
commit
285da13989
@ -24,8 +24,8 @@
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-web</artifactId>
|
||||
<scope>provided</scope> <!-- 设置为 provided,只有 OncePerRequestFilter 使用到 -->
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
<scope>provided</scope> <!-- 设置为 provided,只有 DefaultDBFieldHandler 使用到 -->
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.framework.mybatis.core.handler;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
|
||||
@ -32,7 +32,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
||||
baseDO.setUpdateTime(current);
|
||||
}
|
||||
|
||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
||||
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
|
||||
baseDO.setCreator(userId.toString());
|
||||
@ -54,7 +54,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
||||
|
||||
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
|
||||
Object modifier = getFieldValByName("updater", metaObject);
|
||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
if (Objects.nonNull(userId) && Objects.isNull(modifier)) {
|
||||
setFieldValByName("updater", userId.toString(), metaObject);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user