if(1? != ‘’)
@Query(value = "select id from tbl where if(?1!='', cust_code = ?1, 1=1) " +
"and if(?2!='', name LIKE CONCAT('%',?2,'%'), 1=1) and if(?3 is not null, is_delete = ?3, 1=1) ", nativeQuery = true)
List<Entity> findEntity(String code, String name, Integer isDelete);
if(1? is not null)
@Query(value = "select id from tbl where if(?1 is not null, is_delete = ?1, 1=1) ", nativeQuery = true)
List<Entity> findEntity(Integer isDelete);
if(1? != ‘’ && 1? is not null)
@Query(value = "select id from tbl where if(?1!='' && ?1 is not null, cust_code = ?1, 1=1) " +
"and if(?2!='' && ?2 is not null, name LIKE CONCAT('%',?2,'%'), 1=1) and if(?3 is not null, is_delete = ?3, 1=1) ", nativeQuery = true)
List<Entity> findEntity(String code, String name, Integer isDelete);