refactor: 创建/修改时间字段名修改

This commit is contained in:
郝先瑞 2022-07-03 00:02:11 +08:00
parent 92bc813cc8
commit 2fee49f515

View File

@ -7,8 +7,10 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* 字段自动填充
* mybatis-plus 字段自动填充
*
* @author haoxr
* @date 2022/7/3
* @link https://mp.baomidou.com/guide/auto-fill-metainfo.html
*/
@Component
@ -21,8 +23,8 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
*/
@Override
public void insertFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "gmtCreate", () -> LocalDateTime.now(), LocalDateTime.class);
this.strictUpdateFill(metaObject, "gmtModified", () -> LocalDateTime.now(), LocalDateTime.class);
this.strictInsertFill(metaObject, "createTime", () -> LocalDateTime.now(), LocalDateTime.class);
this.strictUpdateFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class);
}
/**
@ -32,7 +34,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
*/
@Override
public void updateFill(MetaObject metaObject) {
this.strictUpdateFill(metaObject, "gmtModified", () -> LocalDateTime.now(), LocalDateTime.class);
this.strictUpdateFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class);
}
}