例如,结果sql应为:
SELECT * FROM transaction t WHERE t.type = 4 AND (t.status = 1 OR t.value = 2)
但是在查询方法方面,我无法确定它必须如何
public List<Transaction> findByTypeAndStatusAndValue(int type, int status, int value);
我不确定上面的代码是否按预期工作。
答案 0 :(得分:1)
您始终可以提供自定义查询:
@Query("select t from Transaction t where t.type = ?1 and (t.status = ?2 or t.value = ?3)")
public List<Transaction> findByTypeAndStatusOrValue(int type, int status, int value);