diff --git a/src/main/java/kr/xit/framework/biz/cmm/web/XitFrameUtilController.java b/src/main/java/kr/xit/framework/biz/cmm/web/XitFrameUtilController.java index a32bbef5..afa00fa5 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/web/XitFrameUtilController.java +++ b/src/main/java/kr/xit/framework/biz/cmm/web/XitFrameUtilController.java @@ -23,7 +23,7 @@ import kr.xit.framework.core.utils.XitCmmnUtil; * @version 1.0 Copyright(c) XIT All rights reserved. */ @Controller -@RequestMapping("/_cmmn_/util/") +@RequestMapping("/framework/util/") public class XitFrameUtilController { /** @@ -32,9 +32,9 @@ public class XitFrameUtilController { * @author: 박민규 * @date: 2020. 6. 2. */ - @RequestMapping(value="validator.do", method={RequestMethod.GET, RequestMethod.POST}) + @RequestMapping(value="validator", method={RequestMethod.GET, RequestMethod.POST}) public String validate() { - return "framework/cmmn/util/validator"+TILES_TYPE.NONE.getVal(); + return "framework/util/validator"+TILES_TYPE.NONE.getVal(); } /** diff --git a/src/main/java/kr/xit/framework/biz/mng/web/ProgramMngController.java b/src/main/java/kr/xit/framework/biz/mng/web/ProgramMngController.java index 6f4ad80c..1ff52a31 100644 --- a/src/main/java/kr/xit/framework/biz/mng/web/ProgramMngController.java +++ b/src/main/java/kr/xit/framework/biz/mng/web/ProgramMngController.java @@ -17,6 +17,7 @@ import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -132,7 +133,7 @@ public class ProgramMngController { @RequestMapping(value = "/program_{cmd}", method={RequestMethod.GET, RequestMethod.POST}) public String ProgramMng_page(@PathVariable String cmd , @RequestParam(value="tilesDef", required=false, defaultValue="") String tilesDef - , @ModelAttribute("progrmManageVO") ProgramMngVO vo + , @ModelAttribute("progrmMngVO") ProgramMngVO vo , ModelMap model) { switch (cmd) { case "input": //등록 페이지 @@ -140,7 +141,7 @@ public class ProgramMngController { case "edit": //수정 페이지 case "view": //상세 페이지 ProgramMngVO programMngVO = programMngService.findView(vo); - model.addAttribute("progrmManageVO", programMngVO); + model.addAttribute("progrmMngVO", programMngVO); break; default: throw new RuntimeException("유효하지 않은 요청 입니다."); @@ -149,7 +150,7 @@ public class ProgramMngController { if(!"".equals(tilesDef)) tilesDef = "."+tilesDef; - return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/menu/mngProgramMng_"+cmd+tilesDef; + return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/menu/mngProgramMgt_"+cmd+tilesDef; } @@ -165,7 +166,7 @@ public class ProgramMngController { @RequestMapping(value = "/program_{cmd}_popup", method={RequestMethod.GET, RequestMethod.POST}) public String ProgramMng_page_popup(@PathVariable String cmd , @ModelAttribute("searchVO") ProgramMngSearchVO searchVO - , @ModelAttribute("progrmManageVO") ProgramMngVO vo, ModelMap model) { + , @ModelAttribute("progrmMngVO") ProgramMngVO vo, ModelMap model) { switch (cmd) { case "FileNmSearch": //프로그램 파일명 조회 페이지 // 내역 조회 @@ -194,14 +195,14 @@ public class ProgramMngController { break; case "edit" : ProgramMngVO xitProgramMngVO = programMngService.findView(vo); - model.addAttribute("progrmManageVO", xitProgramMngVO); + model.addAttribute("progrmMngVO", xitProgramMngVO); break; default: throw new RuntimeException("유효하지 않은 요청 입니다."); } - return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/menu/mngProgramMng_"+cmd+"_popup"+TILES_TYPE.POPUP.getVal(); + return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/menu/mngProgramMgt_"+cmd+"_popup"+TILES_TYPE.POPUP.getVal(); } @@ -214,9 +215,9 @@ public class ProgramMngController { * @throws ServletException * @date: 2020. 3. 25. */ - @RequestMapping(value = "/program_{cmd}_proc", method=RequestMethod.POST) + @RequestMapping(value = {"/program_{cmd}_proc"}, method=RequestMethod.POST) public void ProgramMng_cmd_proc(@PathVariable String cmd - ,@ModelAttribute("progrmManageVO") ProgramMngVO vo + ,@ModelAttribute("progrmMngVO") ProgramMngVO vo ,@RequestParam(value="checkedProgrmFileNmForDel", required=false, defaultValue="") String checkedProgrmFileNmForDel ,BindingResult bindingResult ,Model model @@ -227,18 +228,18 @@ public class ProgramMngController { /** * 처리 분기 */ - String sLocationUrl = "forward:/mng/menu/programList.do"; + String sLocationUrl = "forward:/framework/biz/mng/menu/programList.do"; String resultMsg = null; switch (cmd) { case "insert": //등록 //유효성 확인 //2020.11.24. 주석처리 beanValidator.validate(vo, bindingResult); -// beanValidator.validate("progrmManageVO", vo, bindingResult); +// beanValidator.validate("progrmMngVO", vo, bindingResult); if (bindingResult.hasErrors()) { // throw new RuntimeException(xitMessageSource.getMessage("fail.common.insert")); resultMsg = xitMessageSource.getMessage("fail.common.insert"); - sLocationUrl = "forward:/mng/menu/program_input.do"; + sLocationUrl = "forward:/framework/biz/mng/menu/program_input.do"; break; } if (vo.getProgrmDc() == null || vo.getProgrmDc().equals("")) { @@ -256,11 +257,11 @@ public class ProgramMngController { //유효성 확인 //2020.11.24. 주석처리 beanValidator.validate(vo, bindingResult); -// beanValidator.validate("progrmManageVO", vo, bindingResult); +// beanValidator.validate("progrmMngVO", vo, bindingResult); if (bindingResult.hasErrors()) { // throw new RuntimeException(xitMessageSource.getMessage("fail.common.update")); resultMsg = xitMessageSource.getMessage("fail.common.update"); - sLocationUrl = "forward:/mng/menu/program_edit.do"; + sLocationUrl = "forward:/framework/biz/mng/menu/program_edit.do"; break; } if (vo.getProgrmDc() == null || vo.getProgrmDc().equals("")) { @@ -279,10 +280,10 @@ public class ProgramMngController { break; } catch (RuntimeException e) { resultMsg = e.getMessage(); - sLocationUrl = "forward:/mng/menu/program_edit.do"; + sLocationUrl = "forward:/framework/biz/mng/menu/program_edit.do"; } catch (Exception e) { resultMsg = xitMessageSource.getMessage("fail.common.delete"); - sLocationUrl = "forward:/mng/menu/program_edit.do"; + sLocationUrl = "forward:/framework/biz/mng/menu/program_edit.do"; } break; @@ -301,9 +302,64 @@ public class ProgramMngController { default: new RuntimeException("유효하지 않은 요청 입니다."); } - - - + + /** + * 응답 설정 + */ + /* ============================ + * 2020.09.10 박민규 + * 서버 호출 방식에 관계 없이 응답처리가 가능하도록 개선 + * -기존 호출방식도 유지하며 ajax로 서버호출 시 json 으로 응답처리가 가능하도록 개선 + * [AS-IS] 반환타입 String, return url에 "forward"구문으로 처리 + * [TO-BE] 반환타입 void, DispatchServlet으로 forward 처리, ajax 호출인 경우 json응답처리 서비스로 forward + ============================ */ + //2020.09.10 주석처리 + // model.addAttribute("resultMsg", resultMsg); + // return sLocationUrl; + model.addAttribute("resultMsg", resultMsg); + + if (XitCmmnUtil.isAjaxRequest(request)) { //ajax 요청시 + //반환 데이터 설정 + Map resultMap = new HashMap(); + resultMap.put("resultMsg", resultMsg); + XitCmmnUtil.forwardForAjaxRequest(request, response, resultMap); + } else { //submit 요청 시 + XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap()); + } + } + + @PostMapping(value = "/updateProgram") + public void updateProgram(@ModelAttribute("progrmMngVO") ProgramMngVO vo + ,@RequestParam(value="checkedProgrmFileNmForDel", required=false, defaultValue="") String checkedProgrmFileNmForDel + ,BindingResult bindingResult + ,Model model + ,HttpServletRequest request + ,HttpServletResponse response + ) throws ServletException, IOException { + + /** + * 처리 분기 + */ + String sLocationUrl = "forward:/framework/biz/mng/menu/programList.do"; + String resultMsg = null; + + //유효성 확인 + //2020.11.24. 주석처리 + beanValidator.validate(vo, bindingResult); + // beanValidator.validate("progrmMngVO", vo, bindingResult); + if (bindingResult.hasErrors()) { + // throw new RuntimeException(xitMessageSource.getMessage("fail.common.update")); + resultMsg = xitMessageSource.getMessage("fail.common.update"); + sLocationUrl = "forward:/framework/biz/mng/menu/program_edit.do"; + }else { + if (vo.getProgrmDc() == null || vo.getProgrmDc().equals("")) { + vo.setProgrmDc(" "); + } + } + //처리 + programMngService.modifyProc(vo); + resultMsg = xitMessageSource.getMessage("success.common.update"); + /** * 응답 설정 */ @@ -315,16 +371,19 @@ public class ProgramMngController { * [TO-BE] 반환타입 void, DispatchServlet으로 forward 처리, ajax 호출인 경우 json응답처리 서비스로 forward ============================ */ //2020.09.10 주석처리 -// model.addAttribute("resultMsg", resultMsg); -// return sLocationUrl; + // model.addAttribute("resultMsg", resultMsg); + // return sLocationUrl; model.addAttribute("resultMsg", resultMsg); - if(XitCmmnUtil.isAjaxRequest(request)){ //ajax 요청시 + + if (XitCmmnUtil.isAjaxRequest(request)) { //ajax 요청시 //반환 데이터 설정 Map resultMap = new HashMap(); resultMap.put("resultMsg", resultMsg); XitCmmnUtil.forwardForAjaxRequest(request, response, resultMap); - }else { //submit 요청 시 + } else { //submit 요청 시 XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap()); } + + } } diff --git a/src/main/java/kr/xit/framework/core/utils/XitCmmnUtil.java b/src/main/java/kr/xit/framework/core/utils/XitCmmnUtil.java index 3a91664c..67a1470c 100644 --- a/src/main/java/kr/xit/framework/core/utils/XitCmmnUtil.java +++ b/src/main/java/kr/xit/framework/core/utils/XitCmmnUtil.java @@ -976,7 +976,7 @@ public class XitCmmnUtil { * 요청 타입별 응답데이터 설정 */ if(isAjaxRequest) { - requestUrl = "/_cmmn_/util/responseJson.do"; //json 데이터로 response 하도록 처리하는 서비스 경로 + requestUrl = "/framework/util/responseJson.do"; //json 데이터로 response 하도록 처리하는 서비스 경로 if(isNoParentKey) { Iterator keys = resultData.keySet().iterator(); while(keys.hasNext()) { diff --git a/src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/mng/menu/program-mysql-mapper.xml similarity index 51% rename from src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-mysql-mapper.xml rename to src/main/resources/sqlmapper/framework/mng/menu/program-mysql-mapper.xml index 6dece3dc..893471b4 100644 --- a/src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/mng/menu/program-mysql-mapper.xml @@ -3,27 +3,8 @@ - - SELECT A.PROGRM_FILE_NM AS "progrmFileNm" - , A.PROGRM_STRE_COURS AS "progrmStrePath" - , A.PROGRM_KOREAN_NM AS "progrmKoreanNm" - /*, CONCAT(DBMS_LOB.SUBSTRING (A.PROGRM_DC, 10, 1),'...') AS "progrmDc" */ - , A.PROGRM_DC AS "progrmDc" - , A.URL AS "URL" - - - FROM XIT_PROGRM_LIST A - - - - AND A.PROGRM_KOREAN_NM LIKE CONCAT('%',#{searchKeyword},'%') - - - - - - - - - - - diff --git a/src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-oracle-mapper.xml b/src/main/resources/sqlmapper/framework/mng/menu/program-oracle-mapper.xml similarity index 97% rename from src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-oracle-mapper.xml rename to src/main/resources/sqlmapper/framework/mng/menu/program-oracle-mapper.xml index 170cef18..02cad126 100644 --- a/src/main/resources/sqlmapper/framework/mng/menu/program/XitProgramMng-oracle-mapper.xml +++ b/src/main/resources/sqlmapper/framework/mng/menu/program-oracle-mapper.xml @@ -1,6 +1,6 @@ - + SELECT * FROM diff --git a/src/main/resources/validator/framework/mng/menu/XitProgramMng.xml b/src/main/resources/validator/framework/mng/menu/XitProgramMng.xml index dc3c7961..7b1b0c35 100644 --- a/src/main/resources/validator/framework/mng/menu/XitProgramMng.xml +++ b/src/main/resources/validator/framework/mng/menu/XitProgramMng.xml @@ -4,7 +4,7 @@ "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd"> -
+ @@ -47,4 +47,4 @@
-
\ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtFrom.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtFrom.jsp index 58f0ad8a..5b791175 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtFrom.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgtFrom.jsp @@ -62,15 +62,12 @@
diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMng_edit.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgt_edit.jsp similarity index 84% rename from src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMng_edit.jsp rename to src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgt_edit.jsp index 069fadf1..7cc79d47 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMng_edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/mng/menu/mngProgramMgt_edit.jsp @@ -8,9 +8,9 @@ <%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> - - - + + +