mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
refactor: 创建/修改时间字段名修改
This commit is contained in:
parent
92bc813cc8
commit
2fee49f515
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user