add: 更新时间设置

This commit is contained in:
wuy 2020-07-14 13:07:53 +08:00
parent 81b204b616
commit 2179e5b161
1 changed files with 11 additions and 1 deletions

View File

@ -176,6 +176,16 @@ public class BaseCustomServiceImpl<M extends BaseCrudMapper<T>, T> extends BaseS
}
}
~~~
## 如何解决数据库无法自动设置更新时间?
* 通过Mybatis-plus的MetaObjectHandler接口自动填充示例
~~~java
@Component
public class FillMetaObjectHandler implements MetaObjectHandler {
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName(Cons.FieldName.updateTime.name(), new Date(), metaObject);
}
}
~~~