update 优化 删除无意义的方法
This commit is contained in:
parent
a098565c37
commit
4f92c0317e
@ -43,19 +43,6 @@ public class ObjectUtils extends ObjectUtil {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 如果值不为空,则返回值
|
|
||||||
*
|
|
||||||
* @param obj 对象
|
|
||||||
* @return 对象字段
|
|
||||||
*/
|
|
||||||
public static <T> T notNull(T obj) {
|
|
||||||
if (isNotNull(obj)) {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果值不为空,则返回值,否则返回默认值
|
* 如果值不为空,则返回值,否则返回默认值
|
||||||
*
|
*
|
||||||
|
@ -71,7 +71,10 @@ public class InjectionMetaObjectHandler implements MetaObjectHandler {
|
|||||||
baseEntity.setUpdateTime(current);
|
baseEntity.setUpdateTime(current);
|
||||||
|
|
||||||
// 获取当前登录用户的ID,并填充更新人信息
|
// 获取当前登录用户的ID,并填充更新人信息
|
||||||
baseEntity.setUpdateBy(ObjectUtils.notNull(LoginHelper.getUserId()));
|
Long userId = LoginHelper.getUserId();
|
||||||
|
if (ObjectUtil.isNotNull(userId)) {
|
||||||
|
baseEntity.setUpdateBy(userId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
|
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user