mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-17 12:54:40 +08:00
fix(orm): make updateTime auto-fill unconditional so rows actually move on update
This commit is contained in:
parent
1d1a818513
commit
a4b8c00eba
@ -22,6 +22,12 @@ public class MybatisPlusConfig implements MetaObjectHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
// Use setFieldValByName (unconditional) rather than strictUpdateFill,
|
||||||
|
// which is a no-op when the field already has a value. After a row
|
||||||
|
// is loaded from the DB its updateTime is non-null, so the strict
|
||||||
|
// variant left the column frozen at insert time forever — every
|
||||||
|
// mate_* table inherited this. Unconditional fill matches the
|
||||||
|
// documented "updateTime moves on every update" expectation.
|
||||||
|
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user