update 优化 删除无意义的方法

This commit is contained in:
疯狂的狮子Li 2024-11-12 10:50:10 +08:00
parent a098565c37
commit 4f92c0317e
2 changed files with 4 additions and 14 deletions

View File

@ -43,19 +43,6 @@ public class ObjectUtils extends ObjectUtil {
return defaultValue;
}
/**
* 如果值不为空则返回值
*
* @param obj 对象
* @return 对象字段
*/
public static <T> T notNull(T obj) {
if (isNotNull(obj)) {
return obj;
}
return null;
}
/**
* 如果值不为空则返回值否则返回默认值
*

View File

@ -71,7 +71,10 @@ public class InjectionMetaObjectHandler implements MetaObjectHandler {
baseEntity.setUpdateTime(current);
// 获取当前登录用户的ID并填充更新人信息
baseEntity.setUpdateBy(ObjectUtils.notNull(LoginHelper.getUserId()));
Long userId = LoginHelper.getUserId();
if (ObjectUtil.isNotNull(userId)) {
baseEntity.setUpdateBy(userId);
}
} else {
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
}