카테고리 없음

other_user_id 매개 변수가 실행 시간에 작동하지 않습니다. 이유를 모르겠습니다.

기록만이살길 2021. 2. 23. 23:06
반응형

other_user_id 매개 변수가 실행 시간에 작동하지 않습니다. 이유를 모르겠습니다.

1. 질문(문제점):

public interface ConnectionsRepository extends CrudRepository<Connections,String> {
    @Query(value = "SELECT * FROM connections WHERE other_user_id=?1 and acceptance=0 and name like %?2% "
            + " or designation like %?2% "
            + " or entity like %?2% "
            + " or location like %?2%"
            + " or contact1 like %?2%"
            + " or contact2 like %?2%"
            + " or icsnid like %?2%"
            + " or email like %?2%",nativeQuery = true)
    List<Connections> getManagingList(String userId,String keyword, int offset);

2. 해결방안:

당신은 단순히 놓치고 있습니다 ()

@Query(value = "SELECT * FROM connections WHERE other_user_id=?1 and acceptance=0 and (name like %?2% "
        + " or designation like %?2% "
        + " or entity like %?2% "
        + " or location like %?2%"
        + " or contact1 like %?2%"
        + " or contact2 like %?2%"
        + " or icsnid like %?2%"
        + " or email like %?2%)",nativeQuery = true)

사이에 차이가 있습니다

a && b && c || d

a && b && (c || d)
65804903
반응형