test: SecondaryMybatis 적용 테스트

dev
sjh88 11 months ago
parent 241fac14fa
commit 3b336408f6

@ -0,0 +1,27 @@
package kr.xit.biz.other.mapper;
import kr.xit.biz.other.model.ElecnoticeDTO;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import java.util.List;
/**
* <pre>
* description : mapper
*
* packageName : kr.xit.biz.other.mapper
* fileName : IBizOtherMapper
* author : seojh
* date : 2024-01-03
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-03 seojh
*
* </pre>
*/
@Mapper
public interface IBizOtherMapper {
List<ElecnoticeDTO.Elecnoticemst> selectElecnoticemst();
}

@ -0,0 +1,122 @@
package kr.xit.biz.other.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* <pre>
* description : DTO
*
* packageName : kr.xit.biz.other.model
* fileName : ElecnoticeDTO
* author : seojh
* date : 2024-01-03
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024-01-03 seojh
*
* </pre>
*/
public class ElecnoticeDTO {
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public static class Elecnoticemst {
/**
*
*/
private String unitysndngmastrid;
/**
*
*/
private String sndngco;
/**
*
*/
private String sndngprocesssttus;
/**
*
*/
private String insuser;
/**
*
*/
private String insdate;
/**
*
*/
private String upduser;
/**
*
*/
private String upddate;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public static class Elecnoticedtl extends Elecnoticemst {
/**
*
*/
private String unitysndngdetailid;
/**
*
*/
private String sndngdt;
/**
*
*/
private String tmplatid;
/**
*
*/
private String gojidepth;
/**
*
*/
private String taxnum1;
/**
*
*/
private String taxnum2;
/**
*
*/
private String taxnum3;
/**
*
*/
private String taxnum4;
/**
*
*/
private String worker;
/**
*
*/
private String serialno;
/**
*
*/
private String recvdt;
/**
*
*/
private String readdt;
/**
*
*/
private String resultcode;
}
}

@ -23,4 +23,5 @@ import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
public interface IPplusService {
PpCommonResponse sendBulks(final SndngMssageParam reqDTO);
PpStatusResponse statusBulks(final PpStatusRequest reqDTO);
String test();
}

@ -13,6 +13,8 @@ import kr.xit.biz.ens.model.pplus.PplusDTO.BatchAcceptRequest;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpCommonResponse;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusRequest;
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
import kr.xit.biz.other.mapper.IBizOtherMapper;
import kr.xit.biz.other.model.ElecnoticeDTO;
import kr.xit.core.service.AbstractService;
import kr.xit.core.spring.annotation.TraceLogging;
import kr.xit.core.spring.util.ApiWebClientUtil;
@ -65,6 +67,7 @@ public class PplusService extends AbstractService implements IPplusService {
private final StringEncryptor jasyptStringEncryptor;
private final ApiWebClientUtil webClient;
private final IPplusMapper mapper;
private final IBizOtherMapper mapper2;
@SuppressWarnings("unchecked")
@Override
@ -142,4 +145,12 @@ public class PplusService extends AbstractService implements IPplusService {
headerMap
);
}
@Override
public String test() {
final List<ElecnoticeDTO.Elecnoticemst> tgtList = mapper2.selectElecnoticemst();
if(tgtList == null) System.out.println("1");
return "test";
}
}

@ -52,4 +52,10 @@ public class PplusController {
PpStatusResponse resDTO = service.statusBulks(paramDTO);
return ApiResponseDTO.success(resDTO);
}
@Operation(summary = "테스트", description = "테스트")
@PostMapping(value = "/test", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse test() {
String msg = service.test();
return ApiResponseDTO.success(msg);
}
}

@ -13,7 +13,13 @@ spring:
password: xit1807
read-only: false
# multi-database
#secondary:
secondary:
database: oracle
driver-class-name: oracle.jdbc.OracleDriver
jdbc-url: jdbc:oracle:thin:@211.119.124.117:1521:ora11g
username: xit_traffic
password: traffic5
read-only: false
devtools:
restart:

@ -76,16 +76,16 @@ spring:
data-source-properties:
rewriteBatchedStatements: true
# secondary:
# pool-name: xit-oracle-pool
# auto-commit: false
# # 인프라의 적용된 connection time limit보다 작아야함
# max-lifetime: 1800000
# maximum-pool-size: 15
# minimum-idle: 5
## transaction-isolation: TRANSACTION_READ_UNCOMMITTED
# data-source-properties:
# rewriteBatchedStatements: true
secondary:
pool-name: xit-oracle-pool
auto-commit: false
# 인프라의 적용된 connection time limit보다 작아야함
max-lifetime: 1800000
maximum-pool-size: 15
minimum-idle: 5
# transaction-isolation: TRANSACTION_READ_UNCOMMITTED
data-source-properties:
rewriteBatchedStatements: true
logging:
level:

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.biz.other.mapper.IBizOtherMapper">
<select id="selectElecnoticemst" resultType="kr.xit.biz.other.model.ElecnoticeDTO$Elecnoticemst">
/** ens-other-oracle-mapper|selectElecnoticemst-전자고지 파일 외부연계 마스터 조회|seojh */
SELECT UNITYSNDNGMASTRID
, SNDNGCO
, SNDNGPROCESSSTTUS
, INSUSER
, INSDATE
, UPDUSER
, UPDDATE
FROM ELECNOTICEMST
</select>
</mapper>

@ -33,7 +33,10 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@Configuration
@ConditionalOnProperty(value = "spring.datasource.hikari.secondary.username")
@MapperScan(
basePackages = {"kr.xit.biz.sms.mapper"},
basePackages = {
"kr.xit.biz.sms.mapper",
"kr.xit.biz.other.mapper",
},
sqlSessionFactoryRef = Constants.SECONDARY_SQL_SESSION
)
public class SecondaryMybatisConfig {
@ -48,6 +51,7 @@ public class SecondaryMybatisConfig {
sessionFactory.setDataSource(dataSource);
sessionFactory.setConfigLocation(resolver.getResource(MYBATIS_CONFIG_FILE));
sessionFactory.setMapperLocations(resolver.getResources(String.format("classpath:/egovframework/mapper/**/*-%s-mapper.xml", database)));
System.out.println("database:"+database);
return sessionFactory.getObject();
}

Loading…
Cancel
Save