add: 更新时间设置
This commit is contained in:
parent
81b204b616
commit
2179e5b161
|
@ -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);
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue