Index: web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java =================================================================== diff -u -r79901aa92959daf45ca73114c064a91cbbb9f91e -r9acfa51a82d6eae6c7e1738728fd414f77b8be94 --- web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java (.../UserPdServiceController.java) (revision 79901aa92959daf45ca73114c064a91cbbb9f91e) +++ web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java (.../UserPdServiceController.java) (revision 9acfa51a82d6eae6c7e1738728fd414f77b8be94) @@ -148,52 +148,52 @@ Statement statement = connection.createStatement(); String sql = "CREATE OR REPLACE TRIGGER \"TRIG_" + reqAddSqlMaaperDTO.getC_title() + "\"\n" + - "BEFORE DELETE OR INSERT OR UPDATE\n" + - "ON " + reqAddSqlMaaperDTO.getC_title() + " REFERENCING NEW AS NEW OLD AS OLD\n" + - "FOR EACH ROW\n" + - "DECLARE\n" + - "tmpVar NUMBER;\n" + - "/******************************************************************************\n" + - " NAME: TRIGGER_COMPREHENSIVETREE\n" + - " PURPOSE: \n" + - " \n" + - " REVISIONS:\n" + - " Ver Date Author Description\n" + - " --------- ---------- --------------- ------------------------------------\n" + - " 1.0 2012-08-29 1. Created this trigger.\n" + - " \n" + - " NOTES:\n" + - " \n" + - " Automatically available Auto Replace Keywords:\n" + - " Object Name: TRIGGER_COMPREHENSIVETREE\n" + - " Sysdate: 2012-08-29\n" + - " Date and Time: 2012-08-29, 오후 5:26:44, and 2012-08-29 오후 5:26:44\n" + - " Username: (set in TOAD Options, Proc Templates)\n" + - " Table Name: T_ARMS_REQADD (set in the \"New PL/SQL Object\" dialog)\n" + - " Trigger Options: (set in the \"New PL/SQL Object\" dialog)\n" + - "******************************************************************************/\n" + - "BEGIN\n" + - " tmpVar := 0;\n" + - " IF UPDATING THEN \n" + - " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + - " values (:old.C_ID,:old.C_PARENTID,:old.C_POSITION,:old.C_LEFT,:old.C_RIGHT,:old.C_LEVEL,:old.C_TITLE,:old.C_TYPE,'update','변경이전데이터',sysdate); \n" + - " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + - " values (:new.C_ID,:new.C_PARENTID,:new.C_POSITION,:new.C_LEFT,:new.C_RIGHT,:new.C_LEVEL,:new.C_TITLE,:new.C_TYPE,'update','변경이후데이터',sysdate); \n" + - " END IF;\n" + - " IF DELETING THEN\n" + - " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + - " values (:old.C_ID,:old.C_PARENTID,:old.C_POSITION,:old.C_LEFT,:old.C_RIGHT,:old.C_LEVEL,:old.C_TITLE,:old.C_TYPE,'delete','삭제된데이터',sysdate);\n" + - " END IF; \n" + - " IF INSERTING THEN\n" + - " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + - " values (:new.C_ID,:new.C_PARENTID,:new.C_POSITION,:new.C_LEFT,:new.C_RIGHT,:new.C_LEVEL,:new.C_TITLE,:new.C_TYPE,'insert','삽입된데이터',sysdate);\n" + - " END IF;\n" + - " \n" + - " EXCEPTION\n" + - " WHEN OTHERS THEN\n" + - " -- Consider logging the error and then re-raise\n" + - " RAISE;\n" + - "END TRIG_" + reqAddSqlMaaperDTO.getC_title() + ";"; + "BEFORE DELETE OR INSERT OR UPDATE\n" + + "ON " + reqAddSqlMaaperDTO.getC_title() + " REFERENCING NEW AS NEW OLD AS OLD\n" + + "FOR EACH ROW\n" + + "DECLARE\n" + + "tmpVar NUMBER;\n" + + "/******************************************************************************\n" + + " NAME: TRIGGER_COMPREHENSIVETREE\n" + + " PURPOSE: \n" + + " \n" + + " REVISIONS:\n" + + " Ver Date Author Description\n" + + " --------- ---------- --------------- ------------------------------------\n" + + " 1.0 2012-08-29 1. Created this trigger.\n" + + " \n" + + " NOTES:\n" + + " \n" + + " Automatically available Auto Replace Keywords:\n" + + " Object Name: TRIGGER_COMPREHENSIVETREE\n" + + " Sysdate: 2012-08-29\n" + + " Date and Time: 2012-08-29, 오후 5:26:44, and 2012-08-29 오후 5:26:44\n" + + " Username: (set in TOAD Options, Proc Templates)\n" + + " Table Name: T_ARMS_REQADD (set in the \"New PL/SQL Object\" dialog)\n" + + " Trigger Options: (set in the \"New PL/SQL Object\" dialog)\n" + + "******************************************************************************/\n" + + "BEGIN\n" + + " tmpVar := 0;\n" + + " IF UPDATING THEN \n" + + " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + + " values (:old.C_ID,:old.C_PARENTID,:old.C_POSITION,:old.C_LEFT,:old.C_RIGHT,:old.C_LEVEL,:old.C_TITLE,:old.C_TYPE,'update','변경이전데이터',sysdate); \n" + + " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + + " values (:new.C_ID,:new.C_PARENTID,:new.C_POSITION,:new.C_LEFT,:new.C_RIGHT,:new.C_LEVEL,:new.C_TITLE,:new.C_TYPE,'update','변경이후데이터',sysdate); \n" + + " END IF;\n" + + " IF DELETING THEN\n" + + " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + + " values (:old.C_ID,:old.C_PARENTID,:old.C_POSITION,:old.C_LEFT,:old.C_RIGHT,:old.C_LEVEL,:old.C_TITLE,:old.C_TYPE,'delete','삭제된데이터',sysdate);\n" + + " END IF; \n" + + " IF INSERTING THEN\n" + + " insert into " + reqAddSqlMaaperDTO.getC_title() + "_LOG (C_ID,C_PARENTID,C_POSITION,C_LEFT,C_RIGHT,C_LEVEL,C_TITLE,C_TYPE,C_METHOD,C_STATE,C_DATE)\n" + + " values (:new.C_ID,:new.C_PARENTID,:new.C_POSITION,:new.C_LEFT,:new.C_RIGHT,:new.C_LEVEL,:new.C_TITLE,:new.C_TYPE,'insert','삽입된데이터',sysdate);\n" + + " END IF;\n" + + " \n" + + " EXCEPTION\n" + + " WHEN OTHERS THEN\n" + + " -- Consider logging the error and then re-raise\n" + + " RAISE;\n" + + "END TRIG_" + reqAddSqlMaaperDTO.getC_title() + ";"; statement.execute(sql); } Index: web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java =================================================================== diff -u -r79901aa92959daf45ca73114c064a91cbbb9f91e -r9acfa51a82d6eae6c7e1738728fd414f77b8be94 --- web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java (.../UserReqAddController.java) (revision 79901aa92959daf45ca73114c064a91cbbb9f91e) +++ web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java (.../UserReqAddController.java) (revision 9acfa51a82d6eae6c7e1738728fd414f77b8be94) @@ -277,48 +277,34 @@ @ResponseBody @RequestMapping( - value = {"/getTest.do"}, + value = {"/makeDB.do"}, method = {RequestMethod.GET} ) - public ModelAndView getSwitchDBTest(ReqAddSqlMaaperDTO reqAddSqlMaaperDTO, HttpServletRequest request) throws Exception { + public ModelAndView makeDefaultDB(ReqAddSqlMaaperDTO reqAddSqlMaaperDTO, HttpServletRequest request) throws Exception { - ParameterParser parser = new ParameterParser(request); - logger.info("UserReqAddController :: getTest :: tableName = " + reqAddSqlMaaperDTO.getC_title()); -// if(reqAddSqlMapper.isExistTable(reqAddSqlMaaperDTO) == 1){ -// logger.error("already exist JSTF table : " + reqAddSqlMaaperDTO.getC_title()); -// }else{ -// reqAddSqlMapper.ddlExecuteToReqAdd(reqAddSqlMaaperDTO); -// reqAddSqlMapper.ddlSequenceExecuteToReqAdd(reqAddSqlMaaperDTO); -// reqAddSqlMapper.dmlExecuteToReqAdd(reqAddSqlMaaperDTO); -// } -// -// String C_title_org = reqAddSqlMaaperDTO.getC_title(); -// reqAddSqlMaaperDTO.setC_title(reqAddSqlMaaperDTO.getC_title() + "_LOG"); -// if(reqAddSqlMapper.isExistTable(reqAddSqlMaaperDTO) == 1){ -// logger.error("already exist log table : " + reqAddSqlMaaperDTO.getC_title()); -// }else{ -// reqAddSqlMaaperDTO.setC_title(C_title_org); -// reqAddSqlMapper.ddlLogExecuteToReqAdd(reqAddSqlMaaperDTO); - //reqAddSqlMapper.ddlTriggerLogSqlExecuteToReqAdd(reqAddSqlMaaperDTO); -// } + if(reqAddSqlMapper.isExistTable(reqAddSqlMaaperDTO) == 1){ + logger.error("already exist JSTF table : " + reqAddSqlMaaperDTO.getC_title()); + }else{ + reqAddSqlMapper.ddlExecuteToReqAdd(reqAddSqlMaaperDTO); + reqAddSqlMapper.ddlSequenceExecuteToReqAdd(reqAddSqlMaaperDTO); + reqAddSqlMapper.dmlExecuteToReqAdd(reqAddSqlMaaperDTO); + } - makeTrigger(reqAddSqlMaaperDTO); + String C_title_org = reqAddSqlMaaperDTO.getC_title(); + reqAddSqlMaaperDTO.setC_title(reqAddSqlMaaperDTO.getC_title() + "_LOG"); + if(reqAddSqlMapper.isExistTable(reqAddSqlMaaperDTO) == 1){ + logger.error("already exist log table : " + reqAddSqlMaaperDTO.getC_title()); + }else{ + reqAddSqlMaaperDTO.setC_title(C_title_org); + reqAddSqlMapper.ddlLogExecuteToReqAdd(reqAddSqlMaaperDTO); + makeTrigger(reqAddSqlMaaperDTO); + } ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", "good"); return modelAndView; -// if (parser.getInt("c_id") <= 0) { -// throw new RuntimeException(); -// } else { -// SessionUtil.setAttribute("replaceTableName",reqAddDTO.getC_title()); -// V returnVO = this.reqAdd.getNode(reqAddDTO); -// SessionUtil.removeAttribute("replaceTableName"); -// ModelAndView modelAndView = new ModelAndView("jsonView"); -// modelAndView.addObject("result", returnVO); -// return modelAndView; -// } } private void makeTrigger(ReqAddSqlMaaperDTO reqAddSqlMaaperDTO) throws SQLException {