疯狂的狮子Li
2024-01-27 bec97982a629b6e8ca3d8fd0c67ddf2b311d628d
update 优化 自动填充更新人逻辑
已修改1个文件
11 ■■■■ 文件已修改
ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/handler/InjectionMetaObjectHandler.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/handler/InjectionMetaObjectHandler.java
@@ -54,13 +54,12 @@
                Date current = new Date();
                // 更新时间填充(不管为不为空)
                baseEntity.setUpdateTime(current);
                if (ObjectUtil.isNull(baseEntity.getUpdateBy())) {
                    LoginUser loginUser = getLoginUser();
                    // 当前已登录 更新人填充(不管为不为空)
                    if (ObjectUtil.isNotNull(loginUser)) {
                        baseEntity.setUpdateBy(loginUser.getUserId());
                    }
                // 当前已登录 更新人填充(不管为不为空)
                Long userId = LoginHelper.getUserId();
                if (ObjectUtil.isNotNull(userId)) {
                    baseEntity.setUpdateBy(userId);
                }
            }
        } catch (Exception e) {
            throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);