feat : send xml 생성 쿼리dsl 조인 한방조회로 수정
parent
ca814fe480
commit
f91b1c021e
@ -1,19 +1,19 @@
|
||||
package com.worker.framework.JPAConf;
|
||||
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class JPAConfig {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Bean
|
||||
public JPAQueryFactory jpaQueryFactory() {
|
||||
return new JPAQueryFactory(em);
|
||||
}
|
||||
}
|
||||
//package com.worker.framework.JPAConf;
|
||||
//
|
||||
//import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
//import jakarta.persistence.EntityManager;
|
||||
//import jakarta.persistence.PersistenceContext;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Configuration
|
||||
//public class JPAConfig {
|
||||
//
|
||||
// @PersistenceContext
|
||||
// private EntityManager em;
|
||||
//
|
||||
// @Bean
|
||||
// public JPAQueryFactory jpaQueryFactory() {
|
||||
// return new JPAQueryFactory(em);
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package com.worker.scheduler.smg.repository;
|
||||
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import com.worker.dto.SinmungoDto;
|
||||
import com.worker.dto.UserInfoDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.worker.domain.entity.QCpAnswer.cpAnswer;
|
||||
import static com.worker.domain.entity.QCpCancel.cpCancel;
|
||||
import static com.worker.domain.entity.QCpMain.cpMain;
|
||||
import static com.worker.domain.entity.QCpSgg.cpSgg;
|
||||
import static com.worker.domain.entity.QCpUser.cpUser;
|
||||
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class XmlSendQueryDslRepository {
|
||||
|
||||
public List<SinmungoDto.Send.SendTarget> findAllByAsState(JPAQueryFactory queryFactory, String state) {
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.fields(
|
||||
SinmungoDto.Send.SendTarget.class,
|
||||
cpAnswer.asSysGubunC,
|
||||
cpAnswer.asState,
|
||||
cpAnswer.asPetiAncCodeV,
|
||||
cpAnswer.asJsno,
|
||||
cpAnswer.asJsnoM,
|
||||
cpAnswer.asText,
|
||||
cpMain.mmCode,
|
||||
cpMain.mmState,
|
||||
cpUser.umName,
|
||||
cpUser.umTelno,
|
||||
cpUser.umEmail,
|
||||
cpSgg.sgDepCode,
|
||||
cpCancel.ccDate
|
||||
)
|
||||
)
|
||||
.from(cpAnswer)
|
||||
.innerJoin(cpMain).on(cpAnswer.asMmcode.eq(cpMain.mmCode))
|
||||
.innerJoin(cpUser).on(cpAnswer.asReuser.eq(cpUser.umCode))
|
||||
.innerJoin(cpSgg).on(cpUser.umSggcode.eq(cpSgg.sgSggCode))
|
||||
.leftJoin(cpCancel).on(cpAnswer.asMmcode.eq(cpCancel.ccMmcode))
|
||||
.where(cpAnswer.asState.eq(state))
|
||||
.fetch();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue