更新时如有需要也自动插入 mac 值
This commit is contained in:
parent
70740762af
commit
132c696cf7
@ -35,5 +35,11 @@ public class CommonMetaObjectHandler implements MetaObjectHandler {
|
||||
if ( metaObject.hasSetter("updateTime") ) {
|
||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
// 插入时,直接基于当前实体对象计算 MAC
|
||||
if (metaObject.hasSetter("mac")) {
|
||||
Object entity = metaObject.getOriginalObject();
|
||||
String mac = Sm3MacCalculator.calculateForEntity(entity);
|
||||
this.strictInsertFill(metaObject, "mac", String.class, mac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user