- LDAPUtil 코드 리팩토링
[Tadpole.git] / com.hangum.tadpole.commons.sql / src / com / hangum / tadpole / engine / query / sql / TadpoleSystemLedger.java
blob5fbab3c1dc0122ae6bfd8ff97c422655b4be4b1e
1 /*******************************************************************************
2 * Copyright (c) 2017 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 *
8 * Contributors:
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com.hangum.tadpole.engine.query.sql;
13 import java.sql.SQLException;
14 import java.text.DateFormat;
15 import java.text.SimpleDateFormat;
16 import java.util.Date;
17 import java.util.HashMap;
18 import java.util.List;
19 import java.util.Map;
21 import org.apache.log4j.Logger;
23 import com.hangum.tadpole.commons.exception.TadpoleSQLManagerException;
24 import com.hangum.tadpole.engine.initialize.TadpoleEngineUserDB;
25 import com.hangum.tadpole.engine.manager.TadpoleSQLManager;
26 import com.hangum.tadpole.engine.query.dao.system.UserDBDAO;
27 import com.hangum.tadpole.engine.query.dao.system.ledger.DelegerHistoryDAO;
28 import com.hangum.tadpole.engine.query.dao.system.ledger.LedgerDAO;
29 import com.ibatis.sqlmap.client.SqlMapClient;
31 /**
32 * Tadpole System ledger query
34 * @author hangum
37 public class TadpoleSystemLedger {
38 /**
39 * Logger for this class
41 private static final Logger logger = Logger.getLogger(TadpoleSystemLedger.class);
43 /**
44 * 오라클 변경이력데이터
45 * @param userDBDAO
47 * @param ledgerDAO
48 * @return
49 * @throws TadpoleSQLManagerException
50 * @throws SQLException
52 public static List<DelegerHistoryDAO> getOracleDetailListLedger(UserDBDAO userDBDAO, LedgerDAO ledgerDAO) throws TadpoleSQLManagerException, SQLException {
54 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDBDAO);
55 return sqlClient.queryForList("getOracleDetailListLedger", ledgerDAO);
58 /**
60 * @param strResult
61 * @param strUser
62 * @param crNumber
63 * @param endTime
64 * @param startTime
65 * @return
66 * @throws TadpoleSQLManagerException
67 * @throws SQLException
69 public static List<LedgerDAO> getMySQLListLedger(String strResult, String strUser, String crNumber, long startTime, long endTime) throws TadpoleSQLManagerException, SQLException {
70 Map<String, Object> mapParam = new HashMap<String, Object>();
71 mapParam.put("strResult", strResult);
72 mapParam.put("strUser", "%" + strUser + "%");
73 mapParam.put("crNumber", "%" + crNumber + "%");
75 Date dateSt = new Date(startTime);
76 DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
77 mapParam.put("startTime", formatter.format(dateSt));
79 Date dateEd = new Date(endTime);
80 mapParam.put("endTime", formatter.format(dateEd));
82 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
83 return sqlClient.queryForList("getMySQLListLedger", mapParam);
86 /**
87 * ledger 정보를 저장한다.
89 * @return
90 * @throws TadpoleSQLManagerException, SQLException
92 public static LedgerDAO insertLedger(LedgerDAO ledger) throws TadpoleSQLManagerException, SQLException {
93 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
94 java.lang.Integer intSeq = (java.lang.Integer)sqlClient.insert("insert_ledger", ledger);
95 ledger.setSeq(intSeq);
97 return ledger;
101 * 원장 데이터 저장 상태를 기록한다.
103 * @param ledgerDAO
105 public static void insertLedgerResult(LedgerDAO ledgerDAO) throws TadpoleSQLManagerException, SQLException {
106 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
107 sqlClient.update("update_ledger_result", ledgerDAO);
111 * 참조 번호 중복 오류 검사
113 * @param cp_seq
114 * @return
115 * @throws TadpoleSQLManagerException
116 * @throws SQLException
118 public static boolean isDuplicationRefenceNumber(String cp_seq) throws TadpoleSQLManagerException, SQLException {
119 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
120 List listKey = sqlClient.queryForList("isDuplicationRefenceNumber", cp_seq);
122 if(listKey.size() == 0) return false;
123 else return true;