allow update createdAt and deletedAt

This commit is contained in:
Timi
2025-12-09 22:19:07 +08:00
parent 413f376a15
commit d3aded669b
2 changed files with 0 additions and 12 deletions

View File

@ -56,12 +56,6 @@ public abstract class AbstractEntityService<T, P> implements BaseService<T, P> {
public void update(T t) { public void update(T t) {
checkMapper(); checkMapper();
if (t instanceof Creatable creatable) {
creatable.setCreatedAt(null);
}
if (t instanceof Deletable deletable) {
deletable.setDeletedAt(null);
}
baseMapper.updateSelective(t); baseMapper.updateSelective(t);
} }

View File

@ -263,15 +263,9 @@ public class SQLProvider {
TimiException.required(meta.idFieldColumn, "not found id field in %s".formatted(meta.entityClass)); TimiException.required(meta.idFieldColumn, "not found id field in %s".formatted(meta.entityClass));
TimiException.required(meta.canUpdate, "not allow update for %s".formatted(meta.entityClass)); TimiException.required(meta.canUpdate, "not allow update for %s".formatted(meta.entityClass));
if (entity instanceof Creatable creatable) {
creatable.setCreatedAt(null);
}
if (entity instanceof Updatable updatable) { if (entity instanceof Updatable updatable) {
updatable.setUpdatedAt(Time.now()); updatable.setUpdatedAt(Time.now());
} }
if (entity instanceof Deletable deletable) {
deletable.setDeletedAt(null);
}
String setClause = meta.fieldColumnList.stream() String setClause = meta.fieldColumnList.stream()
.filter(FieldColumn::isNotId) .filter(FieldColumn::isNotId)
.filter(fc -> fc.isNotNull(entity)) .filter(fc -> fc.isNotNull(entity))