[Querydsl] Case When 사용하기


[Querydsl] Case When 사용하기

CaseBuilder를 통해 CaseWhen 문법 시작 when: 조건문 then: when절이 true일 경우 실행 otherwise: when절이 false일 경우 실행 otherwise가 끝나면 결과 물에 대한 alias(as) 적용 일반적으로는 Entity의 필드명이 자동으로 as 적용됨 하지만 CaseBuilder를 통해 계산한 결과물은 필드명이 없음 alias 하지 않으면 결과물 필드가 어떤 필드로 가야할지 명시되지 않아 오류가 발생 public List selectAuthManageList(Map searchInfo) { String searchKeyword = searchInfo.get("searchKeyword"); List tnAuthorList = queryFactory .select..


원문링크 : [Querydsl] Case When 사용하기