fix upsert time field

This commit is contained in:
bwcx_jzy 2021-12-26 22:18:10 +08:00
parent c03c5c5da7
commit 3ecb8e4f95
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5

View File

@ -146,6 +146,7 @@ public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonS
// def modify time
info.setModifyTimeMillis(ObjectUtil.defaultIfNull(info.getModifyTimeMillis(), SystemClock.now()));
// remove create time
Long createTimeMillis = info.getCreateTimeMillis();
info.setCreateTimeMillis(null);
// fill modify user
if (info instanceof BaseUserModifyDbModel) {
@ -162,7 +163,10 @@ public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonS
//
Entity where = new Entity();
where.set(Const.ID_STR, id);
return super.update(entity, where);
int update = super.update(entity, where);
// backtrack
info.setCreateTimeMillis(createTimeMillis);
return update;
}
@Override