From 2179e5b1617c9c6972a43337757a7256a126a557 Mon Sep 17 00:00:00 2001 From: wuy <1311695042@qq.com> Date: Tue, 14 Jul 2020 13:07:53 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diboot-docs/guide/notes/faq/main.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/diboot-docs/guide/notes/faq/main.md b/diboot-docs/guide/notes/faq/main.md index 97d1aa1..93db075 100644 --- a/diboot-docs/guide/notes/faq/main.md +++ b/diboot-docs/guide/notes/faq/main.md @@ -176,6 +176,16 @@ public class BaseCustomServiceImpl, 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); + } +} +~~~