|
|
@ -1,16 +1,22 @@
|
|
|
|
package com.xit.biz.ctgy.repository;
|
|
|
|
package com.xit.biz.ctgy.repository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.querydsl.core.BooleanBuilder;
|
|
|
|
import com.querydsl.core.QueryResults;
|
|
|
|
import com.querydsl.core.QueryResults;
|
|
|
|
import com.querydsl.core.types.ExpressionUtils;
|
|
|
|
import com.querydsl.core.types.ExpressionUtils;
|
|
|
|
import com.querydsl.core.types.Projections;
|
|
|
|
import com.querydsl.core.types.Projections;
|
|
|
|
import com.querydsl.jpa.JPAExpressions;
|
|
|
|
import com.querydsl.jpa.JPAExpressions;
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
|
|
|
|
import com.xit.biz.ctgy.CtgyConstants;
|
|
|
|
import com.xit.biz.ctgy.dto.GnRecallScDto;
|
|
|
|
import com.xit.biz.ctgy.dto.GnRecallScDto;
|
|
|
|
|
|
|
|
import com.xit.core.util.Checks;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS;
|
|
|
|
import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS;
|
|
|
|
import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc;
|
|
|
|
import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc;
|
|
|
|
|
|
|
|
|
|
|
@ -22,15 +28,22 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Page<GnRecallScDto> findResidents(Pageable pageable) {
|
|
|
|
public Page<GnRecallScDto> findResidents(Pageable pageable) {
|
|
|
|
|
|
|
|
|
|
|
|
// BooleanBuilder builder = new BooleanBuilder();
|
|
|
|
// 커버링 인덱스로 대상 조회
|
|
|
|
// if (!Checks.isEmpty(pMinSimsa680GroupDto.getMsYear())) {
|
|
|
|
QueryResults<Long> scCodeList = queryFactory
|
|
|
|
// builder.and(minSimsa680.msYear.eq(pMinSimsa680GroupDto.getMsYear()));
|
|
|
|
.select(gnRecallSc.scCode)
|
|
|
|
// }
|
|
|
|
.from(gnRecallSc)
|
|
|
|
// if (!Checks.isEmpty(pMinSimsa680GroupDto.getMsChasu())) {
|
|
|
|
.where(gnRecallSc.scDatagb.eq(CtgyConstants.Resident.DATAGB_1.getCode()))
|
|
|
|
// builder.and(minSimsa680.msChasu.like(String.valueOf(pMinSimsa680GroupDto.getMsChasu())));
|
|
|
|
.orderBy(gnRecallSc.scCode.desc())
|
|
|
|
// }
|
|
|
|
.offset(pageable.getPageSize())
|
|
|
|
QueryResults<GnRecallScDto> rslt =
|
|
|
|
.limit(pageable.getPageSize())
|
|
|
|
queryFactory
|
|
|
|
.fetchResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 대상이 없을 경우 추가 쿼리 수행 할 필요 없이 바로 반환
|
|
|
|
|
|
|
|
if (Checks.isEmpty(scCodeList)) {
|
|
|
|
|
|
|
|
new PageImpl<>(new ArrayList<>(), pageable, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GnRecallScDto> rslt = queryFactory
|
|
|
|
.select(Projections.fields(
|
|
|
|
.select(Projections.fields(
|
|
|
|
GnRecallScDto.class,
|
|
|
|
GnRecallScDto.class,
|
|
|
|
gnRecallSc.scCode,
|
|
|
|
gnRecallSc.scCode,
|
|
|
@ -45,27 +58,112 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom {
|
|
|
|
ExpressionUtils.as(
|
|
|
|
ExpressionUtils.as(
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
.from(cmmCodeS)
|
|
|
|
.from(cmmCodeS)
|
|
|
|
.where(gnRecallSc.scContDoc.eq(cmmCodeS.codeCd),cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
.where(gnRecallSc.scContDoc.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
cmmCodeS.codeMcd.eq("SC_CONT_DOC")),
|
|
|
|
cmmCodeS.codeMcd.eq("SC_CONT_DOC")),
|
|
|
|
"scContDocNm"),
|
|
|
|
"scContDocNm"),
|
|
|
|
ExpressionUtils.as(
|
|
|
|
ExpressionUtils.as(
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
.from(cmmCodeS)
|
|
|
|
.from(cmmCodeS)
|
|
|
|
.where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd),cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
.where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
cmmCodeS.codeMcd.eq("RC_INGB")),
|
|
|
|
cmmCodeS.codeMcd.eq("RC_INGB")),
|
|
|
|
"scIngbNm")
|
|
|
|
"scIngbNm")
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.from(gnRecallSc)
|
|
|
|
.from(gnRecallSc)
|
|
|
|
//.where(builder)
|
|
|
|
.where(gnRecallSc.scCode.in(scCodeList.getResults()))
|
|
|
|
//.groupBy(minSimsa680.msYear, minSimsa680.msChasu, minSimsa680.msSdate, minSimsa680.msStartsi, minSimsa680.msEdate, minSimsa680.msCdate, minSimsa680.msClosesi)
|
|
|
|
.orderBy(gnRecallSc.scCode.desc())
|
|
|
|
//.orderBy(minSimsa680.msYear.desc(), minSimsa680.msChasu.desc())
|
|
|
|
.fetch();
|
|
|
|
.offset(pageable.getOffset())
|
|
|
|
|
|
|
|
.limit(pageable.getPageSize())
|
|
|
|
|
|
|
|
.fetchResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new PageImpl<>(rslt, pageable, scCodeList.getTotal());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public GnRecallScDto findResident(Long scCode) {
|
|
|
|
|
|
|
|
BooleanBuilder builder = new BooleanBuilder();
|
|
|
|
|
|
|
|
builder.and(gnRecallSc.scDatagb.eq(CtgyConstants.Resident.DATAGB_1.getCode()));
|
|
|
|
|
|
|
|
builder.and(gnRecallSc.scCode.eq(scCode));
|
|
|
|
|
|
|
|
|
|
|
|
return new PageImpl<>(rslt.getResults(), pageable, rslt.getTotal());
|
|
|
|
return queryFactory
|
|
|
|
|
|
|
|
.select(Projections.fields(
|
|
|
|
|
|
|
|
GnRecallScDto.class,
|
|
|
|
|
|
|
|
gnRecallSc.scCode,
|
|
|
|
|
|
|
|
gnRecallSc.scSeq,
|
|
|
|
|
|
|
|
gnRecallSc.scCarnum,
|
|
|
|
|
|
|
|
gnRecallSc.scName,
|
|
|
|
|
|
|
|
gnRecallSc.scDong,
|
|
|
|
|
|
|
|
gnRecallSc.scContDoc,
|
|
|
|
|
|
|
|
gnRecallSc.scCdate,
|
|
|
|
|
|
|
|
gnRecallSc.scIngb,
|
|
|
|
|
|
|
|
gnRecallSc.scWdate,
|
|
|
|
|
|
|
|
gnRecallSc.scJbtime,
|
|
|
|
|
|
|
|
gnRecallSc.scPos,
|
|
|
|
|
|
|
|
gnRecallSc.scFrecad1,
|
|
|
|
|
|
|
|
gnRecallSc.scFrecad2,
|
|
|
|
|
|
|
|
gnRecallSc.scFrecad3,
|
|
|
|
|
|
|
|
gnRecallSc.scFrecad4,
|
|
|
|
|
|
|
|
gnRecallSc.scContad1,
|
|
|
|
|
|
|
|
gnRecallSc.scContad2,
|
|
|
|
|
|
|
|
gnRecallSc.scContad3,
|
|
|
|
|
|
|
|
gnRecallSc.scContad4,
|
|
|
|
|
|
|
|
gnRecallSc.scContad5,
|
|
|
|
|
|
|
|
gnRecallSc.scContad6,
|
|
|
|
|
|
|
|
gnRecallSc.scContad7,
|
|
|
|
|
|
|
|
gnRecallSc.scContad8,
|
|
|
|
|
|
|
|
gnRecallSc.scPicad1,
|
|
|
|
|
|
|
|
gnRecallSc.scPicad2,
|
|
|
|
|
|
|
|
gnRecallSc.scPicad3,
|
|
|
|
|
|
|
|
gnRecallSc.scPicad4,
|
|
|
|
|
|
|
|
gnRecallSc.scTransfer,
|
|
|
|
|
|
|
|
gnRecallSc.scAnswer,
|
|
|
|
|
|
|
|
gnRecallSc.scState,
|
|
|
|
|
|
|
|
gnRecallSc.zipcode1,
|
|
|
|
|
|
|
|
gnRecallSc.zipcode2,
|
|
|
|
|
|
|
|
gnRecallSc.scJuso,
|
|
|
|
|
|
|
|
gnRecallSc.scBunji,
|
|
|
|
|
|
|
|
ExpressionUtils.as(
|
|
|
|
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
|
|
|
|
.from(cmmCodeS)
|
|
|
|
|
|
|
|
.where(gnRecallSc.scContDoc.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
|
|
|
|
cmmCodeS.codeMcd.eq("SC_CONT_DOC")),
|
|
|
|
|
|
|
|
"scContDocNm"),
|
|
|
|
|
|
|
|
ExpressionUtils.as(
|
|
|
|
|
|
|
|
JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
|
|
|
|
.from(cmmCodeS)
|
|
|
|
|
|
|
|
.where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
|
|
|
|
cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
|
|
|
|
cmmCodeS.codeMcd.eq("RC_INGB")),
|
|
|
|
|
|
|
|
"scIngbNm")
|
|
|
|
|
|
|
|
// ExpressionUtils.as(
|
|
|
|
|
|
|
|
// JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
|
|
|
|
// .from(cmmCodeS)
|
|
|
|
|
|
|
|
// .where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
|
|
|
|
// cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
|
|
|
|
// cmmCodeS.codeMcd.eq("SC_TRANSFER")),
|
|
|
|
|
|
|
|
// "scTransferNm"),
|
|
|
|
|
|
|
|
// ExpressionUtils.as(
|
|
|
|
|
|
|
|
// JPAExpressions.select(cmmCodeS.codeNm)
|
|
|
|
|
|
|
|
// .from(cmmCodeS)
|
|
|
|
|
|
|
|
// .where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd), cmmCodeS.codeGrpId.eq("TRAFFIC"),
|
|
|
|
|
|
|
|
// cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"),
|
|
|
|
|
|
|
|
// cmmCodeS.codeMcd.eq("SC_STATE")),
|
|
|
|
|
|
|
|
// "scStateNm")
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.from(gnRecallSc)
|
|
|
|
|
|
|
|
.where(builder)
|
|
|
|
|
|
|
|
.fetchOne();
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
SELECT SC_CODE, SC_SEQ, SC_CARNUM, SC_NAME, SC_DONG,
|
|
|
|
|
|
|
|
GET_RECALL_CONTID(SC_CONT_DOC) SC_CONT_DOC, SC_CDATE, GET_RECALL_INGB_STR(SC_INGB) SC_INGB, SC_WDATE, SC_JBTIME,
|
|
|
|
|
|
|
|
SC_POS, SC_FRECAD1, SC_FRECAD2, SC_FRECAD3, SC_FRECAD4,
|
|
|
|
|
|
|
|
SC_CONTAD1, SC_CONTAD2, SC_CONTAD3, SC_CONTAD4, SC_CONTAD5,
|
|
|
|
|
|
|
|
SC_CONTAD6, SC_CONTAD7, SC_CONTAD8, SC_PICAD1, SC_PICAD2,
|
|
|
|
|
|
|
|
SC_PICAD3, SC_PICAD4, (SELECT CDNAME FROM MIN_MAINCODE WHERE C2='6' AND C3=SC_TRANSFER) SC_TRANSFER, SC_ANSWER,
|
|
|
|
|
|
|
|
(SELECT CDNAME FROM MIN_MAINCODE WHERE C2='7' AND C3=SC_STATE) SC_STATE, ZIPCODE1, ZIPCODE2, SC_JUSO, SC_BUNJI
|
|
|
|
|
|
|
|
FROM GN_RECALL_SC
|
|
|
|
|
|
|
|
WHERE SC_DATAGB = '1'
|
|
|
|
|
|
|
|
AND SC_CODE =
|
|
|
|
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|