我正在通过 spring 使用 REST API。
我在表中有一个isdeleted
字段,我需要在mysql中查找是否isdeleted =0
然后它显示表中行以及应用程序中的数据列表,但如果 isdeleted=1
,数据保留在数据库的表中,但不会显示在软删除的应用程序的列表中,我如何使用 findall 在存储库文件中实现此条件()
方法
public interface FoodCourtRepository extends JpaRepository<FoodCourtEntity, Long> {
List<FoodCourtEntity> findAll(isdeleted=false???);
}
最佳答案
只需将以下方法添加到您的接口(interface)存储库:
List<FoodCourtEntity> findByDeleted(boolean isDeleted);
您可以了解更多信息 Spring Data JPA documentation
关于java - 休息 api Spring ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45298260/