- 1.7.6 초기 코드
[Tadpole.git] / com.hangum.tadpole.commons.sql / src / com / hangum / tadpole / engine / query / sql / TadpoleSystemLedger.java
blob3aa2fc91a0a78e732597d78f1366dd8f1966cd4a
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.commons.util.ApplicationArgumentUtils;
25 import com.hangum.tadpole.engine.initialize.TadpoleEngineUserDB;
26 import com.hangum.tadpole.engine.manager.TadpoleSQLManager;
27 import com.hangum.tadpole.engine.query.dao.system.UserDBDAO;
28 import com.hangum.tadpole.engine.query.dao.system.ledger.DelegerHistoryDAO;
29 import com.hangum.tadpole.engine.query.dao.system.ledger.LedgerDAO;
30 import com.ibatis.sqlmap.client.SqlMapClient;
32 /**
33 * Tadpole System ledger query
35 * @author hangum
38 public class TadpoleSystemLedger {
39 /**
40 * Logger for this class
42 private static final Logger logger = Logger.getLogger(TadpoleSystemLedger.class);
44 /**
45 * 오라클 변경이력데이터
46 * @param userDBDAO
48 * @param ledgerDAO
49 * @return
50 * @throws TadpoleSQLManagerException
51 * @throws SQLException
53 public static List<DelegerHistoryDAO> getOracleDetailListLedger(UserDBDAO userDBDAO, LedgerDAO ledgerDAO) throws TadpoleSQLManagerException, SQLException {
55 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDBDAO);
56 return sqlClient.queryForList("getOracleDetailListLedger", ledgerDAO);
59 /**
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 strUser, String crNumber, long startTime, long endTime) throws TadpoleSQLManagerException, SQLException {
70 Map<String, Object> mapParam = new HashMap<String, Object>();
71 mapParam.put("strUser", "%" + strUser + "%");
72 mapParam.put("crNumber", "%" + crNumber + "%");
74 if(ApplicationArgumentUtils.isDBServer()) {
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));
81 } else {
82 Date dateSt = new Date(startTime);
83 DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
85 mapParam.put("startTime", formatter.format(dateSt));
87 Date dateEd = new Date(endTime);
88 mapParam.put("endTime", formatter.format(dateEd));
91 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
92 return sqlClient.queryForList("getMySQLListLedger", mapParam);
95 /**
96 * ledger 정보를 저장한다.
98 * @return
99 * @throws TadpoleSQLManagerException, SQLException
101 public static LedgerDAO insertLedger(LedgerDAO ledger) throws TadpoleSQLManagerException, SQLException {
102 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
103 java.lang.Integer intSeq = (java.lang.Integer)sqlClient.insert("insert_ledger", ledger);
104 ledger.setSeq(intSeq);
106 return ledger;
110 * 원장 데이터 저장 상태를 기록한다.
112 * @param ledgerDAO
114 public static void insertLedgerResult(LedgerDAO ledgerDAO) throws TadpoleSQLManagerException, SQLException {
115 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleEngineUserDB.getUserDB());
116 sqlClient.update("update_ledger_result", ledgerDAO);