public interface SoftDeletableJpaRepository<T extends BaseSoftDeletableJpaEntity<ID>,ID> extends BaseJpaRepository<T,ID>
| 限定符和类型 | 方法和说明 |
|---|---|
List<T> |
listAll()
查找所有未删除
|
List<T> |
recycleBin()
查找所有已删除
|
void |
softDelete(ID id)
软删除
查询或删除需要添加 @Modifying注解
|
deleteAllByIdIndeleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlushcount, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save@Query(value="select e from #{#entityName} e where e.deleteFlag=false")
List<T> listAll()
List<T> 结果列表@Query(value="select e from #{#entityName} e where e.deleteFlag=true")
List<T> recycleBin()
List<T>@Query(value="update #{#entityName} e set e.deleteFlag=true where e.id=?1")
@Modifying
void softDelete(ID id)
id - must not be nullCopyright © 2022. All rights reserved.