allow update createdAt and deletedAt
This commit is contained in:
@ -56,12 +56,6 @@ public abstract class AbstractEntityService<T, P> implements BaseService<T, P> {
|
||||
|
||||
public void update(T t) {
|
||||
checkMapper();
|
||||
if (t instanceof Creatable creatable) {
|
||||
creatable.setCreatedAt(null);
|
||||
}
|
||||
if (t instanceof Deletable deletable) {
|
||||
deletable.setDeletedAt(null);
|
||||
}
|
||||
baseMapper.updateSelective(t);
|
||||
}
|
||||
|
||||
|
||||
@ -263,15 +263,9 @@ public class SQLProvider {
|
||||
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));
|
||||
|
||||
if (entity instanceof Creatable creatable) {
|
||||
creatable.setCreatedAt(null);
|
||||
}
|
||||
if (entity instanceof Updatable updatable) {
|
||||
updatable.setUpdatedAt(Time.now());
|
||||
}
|
||||
if (entity instanceof Deletable deletable) {
|
||||
deletable.setDeletedAt(null);
|
||||
}
|
||||
String setClause = meta.fieldColumnList.stream()
|
||||
.filter(FieldColumn::isNotId)
|
||||
.filter(fc -> fc.isNotNull(entity))
|
||||
|
||||
Reference in New Issue
Block a user