fix(orm): make updateTime auto-fill unconditional so rows actually move on update

This commit is contained in:
matevip 2026-05-15 15:21:23 +08:00
parent 1d1a818513
commit a4b8c00eba

View File

@ -22,6 +22,12 @@ public class MybatisPlusConfig implements MetaObjectHandler {
@Override
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);
}
}