Multi DBMS 설정 추가, 발송 성능 개선, 리포트 수신 개선
This commit is contained in:
parent
b517754d01
commit
12accd86eb
@ -21,6 +21,9 @@ configurations {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {url 'https://maven.google.com'}
|
||||
maven {url 'https://maven.cubrid.org/'}
|
||||
maven {url 'https://maven.jumpmind.com/repo/'}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -49,6 +52,11 @@ dependencies {
|
||||
implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '12.8.0.jre11'
|
||||
// https://mvnrepository.com/artifact/org.postgresql/postgresql
|
||||
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.3'
|
||||
// https://mvnrepository.com/artifact/cubrid/cubrid-jdbc
|
||||
implementation group: 'cubrid', name: 'cubrid-jdbc', version: '11.2.1.0038'
|
||||
// https://mvnrepository.com/artifact/jdbc.tibero/tibero
|
||||
//implementation files('libs/tibero6-jdbc-14.jar')
|
||||
implementation files('libs/tibero-6.jar')
|
||||
|
||||
}
|
||||
|
||||
|
||||
BIN
libs/tibero-6.jar
Normal file
BIN
libs/tibero-6.jar
Normal file
Binary file not shown.
BIN
libs/tibero6-jdbc-14.jar
Normal file
BIN
libs/tibero6-jdbc-14.jar
Normal file
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
package com.munjaon.client.cubrid.mapper;
|
||||
|
||||
import com.munjaon.client.model.MunjaonMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CubridMapper {
|
||||
String checkTime();
|
||||
int checkTableForMessage();
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
int insertToLog(String msgId);
|
||||
int deleteFromDeliver(String msgId);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.munjaon.client.cubrid.service;
|
||||
|
||||
import com.munjaon.client.cubrid.mapper.CubridMapper;
|
||||
import com.munjaon.client.model.MunjaonMsg;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CubridService {
|
||||
private final CubridMapper deliverBMapper;
|
||||
|
||||
public boolean checkTableExists() {
|
||||
boolean isExist = false;
|
||||
try {
|
||||
int msgCount = deliverBMapper.checkTableForMessage();
|
||||
int logCount = deliverBMapper.checkTableForLog();
|
||||
if (msgCount >= 0 && logCount >= 0) {
|
||||
isExist = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Check table exists error : {}", e);
|
||||
}
|
||||
|
||||
return isExist;
|
||||
}
|
||||
public List<MunjaonMsg> selectToDeliver(String msgType) {
|
||||
return deliverBMapper.selectToDeliver(msgType);
|
||||
}
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
public List<MunjaonMsg> selectToMove() {
|
||||
return deliverBMapper.selectToMove();
|
||||
}
|
||||
public List<MunjaonMsg> selectToExpire(String expireTime) {
|
||||
return deliverBMapper.selectToExpire(expireTime);
|
||||
}
|
||||
public int insertToLog(String msgId) {
|
||||
return deliverBMapper.insertToLog(msgId);
|
||||
}
|
||||
public int deleteFromDeliver(String msgId) {
|
||||
return deliverBMapper.deleteFromDeliver(msgId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void moveToDeliver() {
|
||||
List<MunjaonMsg> list = selectToMove();
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
log.debug("[CLASS : {} : MOVE_COUNT : {}", this.getClass(), list.size());
|
||||
for (MunjaonMsg msg : list) {
|
||||
insertToLog(msg.getMsgId());
|
||||
deleteFromDeliver(msg.getMsgId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ public interface MariaDBMapper {
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -35,6 +35,9 @@ public class MariaDBService {
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public interface MssqlMapper {
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -35,6 +35,9 @@ public class MssqlService {
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public interface MysqlMapper {
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -35,6 +35,9 @@ public class MysqlService {
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public interface OracleMapper {
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -35,6 +35,9 @@ public class OracleService {
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public interface PostgresqlMapper {
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -35,6 +35,9 @@ public class PostgresqlService {
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectClientService extends Service {
|
||||
@ -25,6 +26,9 @@ public class CollectClientService extends Service {
|
||||
private String id;
|
||||
private String pwd;
|
||||
|
||||
private StringBuilder deliverBuilder;
|
||||
private List<String> deliverList = null;
|
||||
|
||||
public CollectClientService(String serviceName, String serviceType) {
|
||||
super(serviceName);
|
||||
this.serviceType = serviceType;
|
||||
@ -38,8 +42,12 @@ public class CollectClientService extends Service {
|
||||
return;
|
||||
}
|
||||
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
this.IS_READY_YN = worker.checkTableExists();
|
||||
if (this.IS_READY_YN) {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
} else {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is not ready]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,8 +145,28 @@ public class CollectClientService extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setDeliverMsgId(String msgId) {
|
||||
if (msgId == null) {
|
||||
return;
|
||||
}
|
||||
if (this.deliverList == null) {
|
||||
this.deliverList = new ArrayList<>();
|
||||
}
|
||||
this.deliverList.add(msgId);
|
||||
// if (this.deliverBuilder == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (this.deliverBuilder.isEmpty()) {
|
||||
// this.deliverBuilder.append(msgId);
|
||||
// } else {
|
||||
// this.deliverBuilder.append(",").append(msgId);
|
||||
// }
|
||||
}
|
||||
|
||||
private void messageService() {
|
||||
List<MunjaonMsg> list = selectToDeliver();
|
||||
this.deliverBuilder = new StringBuilder();
|
||||
if (list == null || list.isEmpty()) {
|
||||
try {Thread.sleep(1000);} catch (InterruptedException e) {throw new RuntimeException(e);}
|
||||
return;
|
||||
@ -154,6 +182,10 @@ public class CollectClientService extends Service {
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
if (this.deliverList != null && this.deliverList.size() > 0) {
|
||||
worker.updateDeliverForList(this.deliverList);
|
||||
this.deliverList = null; // NULL로 초기화
|
||||
}
|
||||
}
|
||||
|
||||
private void smsMessageService(MunjaonMsg data) {
|
||||
@ -192,14 +224,16 @@ public class CollectClientService extends Service {
|
||||
saveSystemLog("[MESSAGE SEND] [FAIL] [SOCKET IS CLOSED]");
|
||||
throw new RuntimeException("DELIVER ERROR");
|
||||
} else if (recvCount > 0) {
|
||||
worker.updateToDeliver(data.getMsgId());
|
||||
setDeliverMsgId(data.getMsgId());
|
||||
// worker.updateToDeliver(data.getMsgId());
|
||||
saveSystemLog("[MESSAGE SEND] [SUCCESS]");
|
||||
lastPacketSendTime = System.currentTimeMillis();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,12 @@ public class DataMoveService extends Service {
|
||||
return;
|
||||
}
|
||||
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
this.IS_READY_YN = worker.checkTableExists();
|
||||
if (this.IS_READY_YN) {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
} else {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is not ready]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -37,8 +37,12 @@ public class ReportClientService extends Service {
|
||||
return;
|
||||
}
|
||||
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
this.IS_READY_YN = worker.checkTableExists();
|
||||
if (this.IS_READY_YN) {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is ready]");
|
||||
} else {
|
||||
saveSystemLog("[checkReady][DBMS : " + System.getProperty("DBMS") + " is not ready]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,11 +4,13 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DatabaseService {
|
||||
CUBRID_SERVICE,
|
||||
MARIADB_SERVICE,
|
||||
MSSQL_SERVICE,
|
||||
ORACLE_SERVICE,
|
||||
POSTGRESQL_SERVICE,
|
||||
MYSQL_SERVICE;
|
||||
MYSQL_SERVICE,
|
||||
TIBERO_SERVICE;
|
||||
|
||||
private Object service;
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.munjaon.client.service;
|
||||
|
||||
import com.munjaon.client.cubrid.service.CubridService;
|
||||
import com.munjaon.client.mariadb.service.MariaDBService;
|
||||
import com.munjaon.client.mssql.service.MssqlService;
|
||||
import com.munjaon.client.mysql.service.MysqlService;
|
||||
import com.munjaon.client.oracle.service.OracleService;
|
||||
import com.munjaon.client.postgresql.service.PostgresqlService;
|
||||
import com.munjaon.client.tibero.service.TiberoService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -13,6 +15,8 @@ import java.util.EnumSet;
|
||||
|
||||
@Component
|
||||
public class DatabaseServiceInjector {
|
||||
@Autowired
|
||||
private CubridService cubridService;
|
||||
@Autowired
|
||||
private MariaDBService mariaDBService;
|
||||
@Autowired
|
||||
@ -23,11 +27,15 @@ public class DatabaseServiceInjector {
|
||||
private OracleService oracleService;
|
||||
@Autowired
|
||||
private PostgresqlService postgresqlService;
|
||||
@Autowired
|
||||
private TiberoService tiberoService;
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
for (DatabaseService svc : EnumSet.allOf(DatabaseService.class)) {
|
||||
switch (svc) {
|
||||
case CUBRID_SERVICE: svc.setService(cubridService);
|
||||
break;
|
||||
case MARIADB_SERVICE: svc.setService(mariaDBService);
|
||||
break;
|
||||
case MSSQL_SERVICE: svc.setService(mssqlService);
|
||||
@ -38,6 +46,8 @@ public class DatabaseServiceInjector {
|
||||
break;
|
||||
case POSTGRESQL_SERVICE : svc.setService(postgresqlService);
|
||||
break;
|
||||
case TIBERO_SERVICE: svc.setService(tiberoService);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.munjaon.client.service;
|
||||
|
||||
import com.munjaon.client.cubrid.service.CubridService;
|
||||
import com.munjaon.client.mariadb.service.MariaDBService;
|
||||
import com.munjaon.client.model.MunjaonMsg;
|
||||
import com.munjaon.client.mssql.service.MssqlService;
|
||||
import com.munjaon.client.mysql.service.MysqlService;
|
||||
import com.munjaon.client.oracle.service.OracleService;
|
||||
import com.munjaon.client.postgresql.service.PostgresqlService;
|
||||
import com.munjaon.client.tibero.service.TiberoService;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@ -13,6 +15,67 @@ import java.util.List;
|
||||
|
||||
@Getter
|
||||
public enum DatabaseTypeWorker {
|
||||
TYPE_OF_CUBRID("CUBRID") {
|
||||
@Override
|
||||
public boolean checkTableExists() {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.checkTableExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToDeliver(String msgType) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.selectToDeliver(msgType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToDeliver(String msgId) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.updateToReport(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToMove() {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.selectToMove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToExpire(String expireTime) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.selectToExpire(expireTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertToLog(String msgId) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.insertToLog(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteFromDeliver(String msgId) {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
return cubridService.deleteFromDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToDeliver() {
|
||||
CubridService cubridService = (CubridService) DatabaseService.CUBRID_SERVICE.getService();
|
||||
cubridService.moveToDeliver();
|
||||
}
|
||||
},
|
||||
TYPE_OF_MARIADB("MARIADB") {
|
||||
@Override
|
||||
public boolean checkTableExists() {
|
||||
@ -32,6 +95,12 @@ public enum DatabaseTypeWorker {
|
||||
return mariaDBService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
MariaDBService mariaDBService = (MariaDBService) DatabaseService.MARIADB_SERVICE.getService();
|
||||
return mariaDBService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
MariaDBService mariaDBService = (MariaDBService) DatabaseService.MARIADB_SERVICE.getService();
|
||||
@ -87,6 +156,12 @@ public enum DatabaseTypeWorker {
|
||||
return oracleService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
OracleService oracleService = (OracleService) DatabaseService.ORACLE_SERVICE.getService();
|
||||
return oracleService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
OracleService oracleService = (OracleService) DatabaseService.ORACLE_SERVICE.getService();
|
||||
@ -142,6 +217,12 @@ public enum DatabaseTypeWorker {
|
||||
return mssqlService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
MssqlService mssqlService = (MssqlService) DatabaseService.MSSQL_SERVICE.getService();
|
||||
return mssqlService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
MssqlService mssqlService = (MssqlService) DatabaseService.MSSQL_SERVICE.getService();
|
||||
@ -197,6 +278,12 @@ public enum DatabaseTypeWorker {
|
||||
return postgresqlService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
PostgresqlService postgresqlService = (PostgresqlService) DatabaseService.POSTGRESQL_SERVICE.getService();
|
||||
return postgresqlService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
PostgresqlService postgresqlService = (PostgresqlService) DatabaseService.POSTGRESQL_SERVICE.getService();
|
||||
@ -252,6 +339,12 @@ public enum DatabaseTypeWorker {
|
||||
return mysqlService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
MysqlService mysqlService = (MysqlService) DatabaseService.MYSQL_SERVICE.getService();
|
||||
return mysqlService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
MysqlService mysqlService = (MysqlService) DatabaseService.MYSQL_SERVICE.getService();
|
||||
@ -287,6 +380,67 @@ public enum DatabaseTypeWorker {
|
||||
MysqlService mysqlService = (MysqlService) DatabaseService.MYSQL_SERVICE.getService();
|
||||
mysqlService.moveToDeliver();
|
||||
}
|
||||
},
|
||||
TYPE_OF_TIBERO("TIBERO") {
|
||||
@Override
|
||||
public boolean checkTableExists() {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.checkTableExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToDeliver(String msgType) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.selectToDeliver(msgType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToDeliver(String msgId) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.updateToDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.updateDeliverForList(msgIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.updateToReport(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToMove() {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.selectToMove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MunjaonMsg> selectToExpire(String expireTime) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.selectToExpire(expireTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertToLog(String msgId) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.insertToLog(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteFromDeliver(String msgId) {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
return tiberoService.deleteFromDeliver(msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToDeliver() {
|
||||
TiberoService tiberoService = (TiberoService) DatabaseService.TIBERO_SERVICE.getService();
|
||||
tiberoService.moveToDeliver();
|
||||
}
|
||||
};
|
||||
|
||||
DatabaseTypeWorker(final String name) {
|
||||
@ -306,6 +460,7 @@ public enum DatabaseTypeWorker {
|
||||
public abstract boolean checkTableExists();
|
||||
public abstract List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
public abstract int updateToDeliver(String msgId);
|
||||
public abstract int updateDeliverForList(List<String> msgIdList);;
|
||||
public abstract int updateToReport(MunjaonMsg params);
|
||||
public abstract List<MunjaonMsg> selectToMove();
|
||||
public abstract List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.munjaon.client.tibero.mapper;
|
||||
|
||||
import com.munjaon.client.model.MunjaonMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TiberoMapper {
|
||||
String checkTime();
|
||||
int checkTableForMessage();
|
||||
int checkTableForLog();
|
||||
List<MunjaonMsg> selectToDeliver(String msgType);
|
||||
int updateToDeliver(String msgId);
|
||||
int updateDeliverForList(List<String> msgIdList);
|
||||
int updateToReport(MunjaonMsg params);
|
||||
List<MunjaonMsg> selectToMove();
|
||||
List<MunjaonMsg> selectToExpire(String expireTime);
|
||||
int insertToLog(String msgId);
|
||||
int deleteFromDeliver(String msgId);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.munjaon.client.tibero.service;
|
||||
|
||||
import com.munjaon.client.model.MunjaonMsg;
|
||||
import com.munjaon.client.tibero.mapper.TiberoMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TiberoService {
|
||||
private final TiberoMapper deliverBMapper;
|
||||
|
||||
public boolean checkTableExists() {
|
||||
boolean isExist = false;
|
||||
try {
|
||||
int msgCount = deliverBMapper.checkTableForMessage();
|
||||
int logCount = deliverBMapper.checkTableForLog();
|
||||
if (msgCount >= 0 && logCount >= 0) {
|
||||
isExist = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Check table exists error : {}", e);
|
||||
}
|
||||
|
||||
return isExist;
|
||||
}
|
||||
public List<MunjaonMsg> selectToDeliver(String msgType) {
|
||||
return deliverBMapper.selectToDeliver(msgType);
|
||||
}
|
||||
public int updateToDeliver(String msgId) {
|
||||
return deliverBMapper.updateToDeliver(msgId);
|
||||
}
|
||||
public int updateDeliverForList(List<String> msgIdList) {
|
||||
return deliverBMapper.updateDeliverForList(msgIdList);
|
||||
}
|
||||
public int updateToReport(MunjaonMsg params) {
|
||||
return deliverBMapper.updateToReport(params);
|
||||
}
|
||||
public List<MunjaonMsg> selectToMove() {
|
||||
return deliverBMapper.selectToMove();
|
||||
}
|
||||
public List<MunjaonMsg> selectToExpire(String expireTime) {
|
||||
return deliverBMapper.selectToExpire(expireTime);
|
||||
}
|
||||
public int insertToLog(String msgId) {
|
||||
return deliverBMapper.insertToLog(msgId);
|
||||
}
|
||||
public int deleteFromDeliver(String msgId) {
|
||||
return deliverBMapper.deleteFromDeliver(msgId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void moveToDeliver() {
|
||||
List<MunjaonMsg> list = selectToMove();
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
log.debug("[CLASS : {} : MOVE_COUNT : {}", this.getClass(), list.size());
|
||||
for (MunjaonMsg msg : list) {
|
||||
insertToLog(msg.getMsgId());
|
||||
deleteFromDeliver(msg.getMsgId());
|
||||
}
|
||||
}
|
||||
}
|
||||
103
src/main/resources/sqlmap/cubrid/cubrid_sql.xml
Normal file
103
src/main/resources/sqlmap/cubrid/cubrid_sql.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<?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="com.munjaon.client.cubrid.mapper.CubridMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* CubridMapper.checkTime */
|
||||
SELECT DATE_FORMAT(NOW(), '%Y%m%d%H%i%s')
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* CubridMapper.checkTableForMessage */
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG WHERE 1=1 LIMIT 1
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* CubridMapper.checkTableForLog */
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG_LOG WHERE 1=1 LIMIT 1
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* CubridMapper.selectToDeliver */
|
||||
SELECT
|
||||
MSG_ID
|
||||
, MSG_TYPE
|
||||
, to_char(REQUEST_DATE, 'YYYYMMDDHH24MISS') RESERVE_DATE
|
||||
, to_char(SYSDATETIME, 'YYYYMMDDHH24MISS') REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, SUBJECT
|
||||
, MESSAGE
|
||||
, FILENAME01
|
||||
, FILENAME02
|
||||
, FILENAME03
|
||||
, KAKAO_SENDER_KEY
|
||||
, KAKAO_TEMPLATE_CODE
|
||||
, KAKAO_JSON_FILE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND MSG_TYPE = #{msgType}
|
||||
AND REQUEST_DATE <![CDATA[<=]]> SYSDATETIME
|
||||
ORDER BY REQUEST_DATE ASC
|
||||
LIMIT 100
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* CubridMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATETIME
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* CubridMapper.updateDeliverForList */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATETIME
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* CubridMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = FROM_UNIXTIME(UNIX_TIMESTAMP(#{sendDate}))
|
||||
, REPORT_DATE = NOW()
|
||||
, TELECOM = #{telecom}
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* CubridMapper.selectToMove */
|
||||
SELECT MSG_ID, to_date(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE SEND_STATUS NOT IN ('0', '1')
|
||||
LIMIT 100
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* CubridMapper.selectToExpire */
|
||||
SELECT MSG_ID, to_date(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE REQUEST_DATE <![CDATA[<]]> FROM_UNIXTIME(UNIX_TIMESTAMP(#{expireTime}))
|
||||
AND SEND_STATUS = '1'
|
||||
LIMIT 100
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* CubridMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
RECV_PHONE, SEND_PHONE, SUBJECT, MESSAGE, TELECOM,
|
||||
FILENAME01, FILENAME02, FILENAME03, DELIVER_DATE, SENT_DATE, REPORT_DATE
|
||||
)
|
||||
SELECT
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
RECV_PHONE, SEND_PHONE, SUBJECT, MESSAGE, TELECOM,
|
||||
FILENAME01, FILENAME02, FILENAME03, DELIVER_DATE, SENT_DATE, REPORT_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* CubridMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -50,6 +50,18 @@
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList" parameterType="java.util.List">
|
||||
/* MariaDBMapper.updateDeliverForList */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* MariaDBMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
|
||||
@ -2,24 +2,24 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.client.mssql.mapper.MssqlMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* MariaDBMapper.checkTime */
|
||||
/* MssqlMapper.checkTime */
|
||||
SELECT GETDATE()
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* MariaDBMapper.checkTableForMessage */
|
||||
/* MssqlMapper.checkTableForMessage */
|
||||
-- SELECT 1 FROM MUNJAON_MSG WHERE 1=1 LIMIT 1
|
||||
<![CDATA[
|
||||
SELECT TOP 1 COUNT(MSG_ID) FROM MUNJAON_MSG WHERE 1=1
|
||||
]]>
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* MariaDBMapper.checkTableForLog */
|
||||
/* MssqlMapper.checkTableForLog */
|
||||
<![CDATA[
|
||||
SELECT TOP 1 COUNT(MSG_ID) FROM MUNJAON_MSG_LOG WHERE 1=1
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToDeliver */
|
||||
/* MssqlMapper.selectToDeliver */
|
||||
<![CDATA[
|
||||
SELECT
|
||||
TOP 100
|
||||
@ -45,14 +45,26 @@
|
||||
]]>
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* MariaDBMapper.updateToDeliver */
|
||||
/* MssqlMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = GETDATE()
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* MssqlMapper.updateDeliverForList */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = GETDATE()
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* MariaDBMapper.updateToReport */
|
||||
/* MssqlMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = CAST(#{sendDate} AS DATETIME)
|
||||
@ -61,7 +73,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToMove */
|
||||
/* MssqlMapper.selectToMove */
|
||||
<![CDATA[
|
||||
SELECT TOP 100
|
||||
MSG_ID, CONVERT(VARCHAR(6),REQUEST_DATE,112) REQUEST_DATE
|
||||
@ -70,7 +82,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToExpire */
|
||||
/* MssqlMapper.selectToExpire */
|
||||
<![CDATA[
|
||||
SELECT TOP 100
|
||||
MSG_ID, CONVERT(VARCHAR(6),REQUEST_DATE,112) REQUEST_DATE
|
||||
@ -80,7 +92,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* MariaDBMapper.insertToLog */
|
||||
/* MssqlMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
@ -95,7 +107,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* MariaDBMapper.deleteFromDeliver */
|
||||
/* MssqlMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
|
||||
@ -2,25 +2,24 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.client.mysql.mapper.MysqlMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* MariaDBMapper.checkTime */
|
||||
/* MysqlMapper.checkTime */
|
||||
SELECT DATE_FORMAT(NOW(), '%Y%m%d%H%i%s')
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* MariaDBMapper.checkTableForMessage */
|
||||
-- SELECT 1 FROM MUNJAON_MSG WHERE 1=1 LIMIT 1
|
||||
/* MysqlMapper.checkTableForMessage */
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.tables
|
||||
WHERE TABLE_NAME = 'MUNJAON_MSG'
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* MariaDBMapper.checkTableForLog */
|
||||
/* MysqlMapper.checkTableForLog */
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.tables
|
||||
WHERE TABLE_NAME = 'MUNJAON_MSG_LOG'
|
||||
-- SELECT 1 FROM MUNJAON_MSG_LOG WHERE 1=1 LIMIT 1
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToDeliver */
|
||||
/* MysqlMapper.selectToDeliver */
|
||||
SELECT
|
||||
MSG_ID
|
||||
, MSG_TYPE
|
||||
@ -44,14 +43,26 @@
|
||||
LIMIT 100
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* MariaDBMapper.updateToDeliver */
|
||||
/* MysqlMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* MysqlMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* MariaDBMapper.updateToReport */
|
||||
/* MysqlMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = FROM_UNIXTIME(UNIX_TIMESTAMP(#{sendDate}))
|
||||
@ -60,14 +71,14 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToMove */
|
||||
/* MysqlMapper.selectToMove */
|
||||
SELECT MSG_ID, DATE_FORMAT(REQUEST_DATE, '%Y%m') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE SEND_STATUS NOT IN ('0', '1')
|
||||
LIMIT 100
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToExpire */
|
||||
/* MysqlMapper.selectToExpire */
|
||||
SELECT MSG_ID, DATE_FORMAT(REQUEST_DATE, '%Y%m') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE REQUEST_DATE <![CDATA[<]]> FROM_UNIXTIME(UNIX_TIMESTAMP(#{expireTime}))
|
||||
@ -75,7 +86,7 @@
|
||||
LIMIT 100
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* MariaDBMapper.insertToLog */
|
||||
/* MysqlMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
@ -90,7 +101,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* MariaDBMapper.deleteFromDeliver */
|
||||
/* MysqlMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
|
||||
@ -2,24 +2,23 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.client.oracle.mapper.OracleMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* MariaDBMapper.checkTime */
|
||||
/* OracleMapper.checkTime */
|
||||
SELECT TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') FROM DUAL
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* MariaDBMapper.checkTableForMessage */
|
||||
-- SELECT 1 FROM MUNJAON_MSG WHERE 1=1 LIMIT 1
|
||||
/* OracleMapper.checkTableForMessage */
|
||||
<![CDATA[
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG WHERE 1=1 AND rownum <= 1
|
||||
]]>
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* MariaDBMapper.checkTableForLog */
|
||||
/* OracleMapper.checkTableForLog */
|
||||
<![CDATA[
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG_LOG WHERE 1=1 AND rownum <= 1
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToDeliver */
|
||||
/* OracleMapper.selectToDeliver */
|
||||
<![CDATA[
|
||||
SELECT
|
||||
MSG_ID
|
||||
@ -45,14 +44,26 @@
|
||||
]]>
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* MariaDBMapper.updateToDeliver */
|
||||
/* OracleMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATE
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* OracleMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATE
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* MariaDBMapper.updateToReport */
|
||||
/* OracleMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = TO_DATE(#{sendDate}, 'YYYYMMDDHH24MISS')
|
||||
@ -61,7 +72,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToMove */
|
||||
/* OracleMapper.selectToMove */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
@ -70,7 +81,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToExpire */
|
||||
/* OracleMapper.selectToExpire */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
@ -80,7 +91,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* MariaDBMapper.insertToLog */
|
||||
/* OracleMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
@ -95,7 +106,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* MariaDBMapper.deleteFromDeliver */
|
||||
/* OracleMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
|
||||
@ -2,19 +2,19 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.munjaon.client.postgresql.mapper.PostgresqlMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* MariaDBMapper.checkTime */
|
||||
/* PostgresqlMapper.checkTime */
|
||||
SELECT TO_CHAR(NOW(), 'YYYYMMDDHH24MISS') FROM DUAL
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* MariaDBMapper.checkTableForMessage */
|
||||
/* PostgresqlMapper.checkTableForMessage */
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG WHERE 1=1 LIMIT 1
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* MariaDBMapper.checkTableForLog */
|
||||
/* PostgresqlMapper.checkTableForLog */
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG_LOG WHERE 1=1 LIMIT 1
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToDeliver */
|
||||
/* PostgresqlMapper.selectToDeliver */
|
||||
<![CDATA[
|
||||
SELECT
|
||||
MSG_ID
|
||||
@ -40,14 +40,26 @@
|
||||
]]>
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* MariaDBMapper.updateToDeliver */
|
||||
/* PostgresqlMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* PostgresqlMapper.updateDeliverForList */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = NOW()
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* MariaDBMapper.updateToReport */
|
||||
/* PostgresqlMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = TO_DATE(#{sendDate}, 'YYYYMMDDHH24MISS')
|
||||
@ -56,7 +68,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToMove */
|
||||
/* PostgresqlMapper.selectToMove */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
@ -65,7 +77,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* MariaDBMapper.selectToExpire */
|
||||
/* PostgresqlMapper.selectToExpire */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
@ -75,7 +87,7 @@
|
||||
]]>
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* MariaDBMapper.insertToLog */
|
||||
/* PostgresqlMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
@ -90,7 +102,7 @@
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* MariaDBMapper.deleteFromDeliver */
|
||||
/* PostgresqlMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
|
||||
113
src/main/resources/sqlmap/tibero/tibero_sql.xml
Normal file
113
src/main/resources/sqlmap/tibero/tibero_sql.xml
Normal file
@ -0,0 +1,113 @@
|
||||
<?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="com.munjaon.client.tibero.mapper.TiberoMapper">
|
||||
<select id="checkTime" resultType="String">
|
||||
/* OracleMapper.checkTime */
|
||||
SELECT TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') FROM DUAL
|
||||
</select>
|
||||
<select id="checkTableForMessage" resultType="int">
|
||||
/* OracleMapper.checkTableForMessage */
|
||||
<![CDATA[
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG WHERE 1=1 AND rownum <= 1
|
||||
]]>
|
||||
</select>
|
||||
<select id="checkTableForLog" resultType="int">
|
||||
/* OracleMapper.checkTableForLog */
|
||||
<![CDATA[
|
||||
SELECT COUNT(MSG_ID) FROM MUNJAON_MSG_LOG WHERE 1=1 AND rownum <= 1
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToDeliver" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* OracleMapper.selectToDeliver */
|
||||
<![CDATA[
|
||||
SELECT
|
||||
MSG_ID
|
||||
, MSG_TYPE
|
||||
, TO_CHAR(REQUEST_DATE,'YYYYMMDDHH24MISS') RESERVE_DATE
|
||||
, TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS') REQUEST_DATE
|
||||
, RECV_PHONE
|
||||
, SEND_PHONE
|
||||
, SUBJECT
|
||||
, MESSAGE
|
||||
, FILENAME01
|
||||
, FILENAME02
|
||||
, FILENAME03
|
||||
, KAKAO_SENDER_KEY
|
||||
, KAKAO_TEMPLATE_CODE
|
||||
, KAKAO_JSON_FILE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND MSG_TYPE = #{msgType}
|
||||
AND REQUEST_DATE <= SYSDATE
|
||||
AND ROWNUM <= 100
|
||||
ORDER BY REQUEST_DATE ASC
|
||||
]]>
|
||||
</select>
|
||||
<update id="updateToDeliver">
|
||||
/* OracleMapper.updateToDeliver */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATE
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<update id="updateDeliverForList">
|
||||
/* OracleMapper.updateDeliverForList */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = '1'
|
||||
, DELIVER_DATE = SYSDATE
|
||||
WHERE SEND_STATUS = '0'
|
||||
AND (
|
||||
<foreach separator="OR" item="item" collection="list">
|
||||
MSG_ID = #{item}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="updateToReport">
|
||||
/* OracleMapper.updateToReport */
|
||||
UPDATE MUNJAON_MSG SET
|
||||
SEND_STATUS = #{sendStatus}
|
||||
, SENT_DATE = TO_DATE(#{sendDate}, 'YYYYMMDDHH24MISS')
|
||||
, REPORT_DATE = SYSDATE
|
||||
, TELECOM = #{telecom}
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</update>
|
||||
<select id="selectToMove" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* OracleMapper.selectToMove */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE SEND_STATUS NOT IN ('0', '1')
|
||||
AND ROWNUM <= 100
|
||||
]]>
|
||||
</select>
|
||||
<select id="selectToExpire" resultType="com.munjaon.client.model.MunjaonMsg">
|
||||
/* OracleMapper.selectToExpire */
|
||||
<![CDATA[
|
||||
SELECT MSG_ID, TO_CHAR(REQUEST_DATE, 'YYYYMM') REQUEST_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE REQUEST_DATE < TO_DATE(#{expireTime}, 'YYYYMMDDHH24MISS')
|
||||
AND SEND_STATUS = '1'
|
||||
AND ROWNUM <= 100
|
||||
]]>
|
||||
</select>
|
||||
<insert id="insertToLog">
|
||||
/* OracleMapper.insertToLog */
|
||||
INSERT INTO MUNJAON_MSG_LOG
|
||||
(
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
RECV_PHONE, SEND_PHONE, SUBJECT, MESSAGE, TELECOM,
|
||||
FILENAME01, FILENAME02, FILENAME03, DELIVER_DATE, SENT_DATE, REPORT_DATE
|
||||
)
|
||||
SELECT
|
||||
MSG_ID, MSG_TYPE, SEND_STATUS, REQUEST_DATE,
|
||||
RECV_PHONE, SEND_PHONE, SUBJECT, MESSAGE, TELECOM,
|
||||
FILENAME01, FILENAME02, FILENAME03, DELIVER_DATE, SENT_DATE, REPORT_DATE
|
||||
FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</insert>
|
||||
<delete id="deleteFromDeliver">
|
||||
/* OracleMapper.deleteFromDeliver */
|
||||
DELETE FROM MUNJAON_MSG
|
||||
WHERE MSG_ID = #{msgId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user