diff --git a/src/main/java/kr/xit/fims/biz/rt/mapper/Rt0200Mapper.java b/src/main/java/kr/xit/fims/biz/rt/mapper/Rt0200Mapper.java index 839cb67b..5a1348a9 100644 --- a/src/main/java/kr/xit/fims/biz/rt/mapper/Rt0200Mapper.java +++ b/src/main/java/kr/xit/fims/biz/rt/mapper/Rt0200Mapper.java @@ -1,15 +1,15 @@ package kr.xit.fims.biz.rt.mapper; -import egovframework.rte.psl.dataaccess.mapper.Mapper; - import java.util.List; import java.util.Map; +import egovframework.rte.psl.dataaccess.mapper.Mapper; +import kr.xit.fims.biz.rt.model.Rt0200SearchVO; import kr.xit.fims.biz.rt.model.Rt0200VO; + import org.apache.ibatis.session.RowBounds; @Mapper -//public interface Rt0200Mapper extends FimsMapperStrategy { public interface Rt0200Mapper { // 목록조회 @@ -17,6 +17,7 @@ public interface Rt0200Mapper { // 목록조회 (페이징) List> selectRt0200List(Map map, RowBounds rowBounds); + List> selectRt0200List(Rt0200SearchVO vo, RowBounds rowBounds); List findSndngProcessSttus(); diff --git a/src/main/java/kr/xit/fims/biz/rt/service/Rt0200Service.java b/src/main/java/kr/xit/fims/biz/rt/service/Rt0200Service.java index 472de88d..94bd9005 100644 --- a/src/main/java/kr/xit/fims/biz/rt/service/Rt0200Service.java +++ b/src/main/java/kr/xit/fims/biz/rt/service/Rt0200Service.java @@ -1,6 +1,7 @@ package kr.xit.fims.biz.rt.service; +import kr.xit.fims.biz.rt.model.Rt0200SearchVO; import kr.xit.fims.biz.rt.model.Rt0200VO; import java.util.List; @@ -10,6 +11,7 @@ import org.apache.ibatis.session.RowBounds; public interface Rt0200Service { public List> findRt0200List(Map paramMap, RowBounds rowBounds); + public List> findRt0200List(Rt0200SearchVO vo, RowBounds rowBounds); public List findSndngProcessSttus(); Rt0200VO findRt0200(String reglt_id); diff --git a/src/main/java/kr/xit/fims/biz/rt/service/impl/Rt0200ServiceImpl.java b/src/main/java/kr/xit/fims/biz/rt/service/impl/Rt0200ServiceImpl.java index fb834d39..9fde3746 100644 --- a/src/main/java/kr/xit/fims/biz/rt/service/impl/Rt0200ServiceImpl.java +++ b/src/main/java/kr/xit/fims/biz/rt/service/impl/Rt0200ServiceImpl.java @@ -1,6 +1,7 @@ package kr.xit.fims.biz.rt.service.impl; import kr.xit.fims.biz.rt.mapper.Rt0200Mapper; +import kr.xit.fims.biz.rt.model.Rt0200SearchVO; import kr.xit.fims.biz.rt.model.Rt0200VO; import kr.xit.fims.biz.rt.service.Rt0200Service; import lombok.RequiredArgsConstructor; @@ -22,6 +23,11 @@ public class Rt0200ServiceImpl implements Rt0200Service { return rt0200Mapper.selectRt0200List(paramMap, rowBounds); } + @Override + public List> findRt0200List(Rt0200SearchVO vo, RowBounds rowBounds) { + return rt0200Mapper.selectRt0200List(vo, rowBounds); + } + @Override public Rt0200VO findRt0200(String reglt_id) { return rt0200Mapper.selectRt0200(reglt_id); diff --git a/src/main/java/kr/xit/fims/biz/rt/web/Rt0200Controller.java b/src/main/java/kr/xit/fims/biz/rt/web/Rt0200Controller.java index 2864404c..c32d03de 100644 --- a/src/main/java/kr/xit/fims/biz/rt/web/Rt0200Controller.java +++ b/src/main/java/kr/xit/fims/biz/rt/web/Rt0200Controller.java @@ -1,5 +1,6 @@ package kr.xit.fims.biz.rt.web; +import kr.xit.fims.biz.rt.model.Rt0200SearchVO; import kr.xit.fims.biz.rt.service.Rt0200Service; import kr.xit.framework.core.message.XitMessageSource; import kr.xit.framework.core.model.ResultResponse; @@ -9,6 +10,7 @@ import kr.xit.framework.support.mybatis.MybatisUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -51,8 +53,8 @@ public class Rt0200Controller { * @author: 최정민 * @date: 2022. 09. 14. */ - @GetMapping(value = "/rtRt0200Sel") - public ModelAndView rtRt0200Sel(HttpServletRequest req, Model model){ + @GetMapping(value = "/rt0200Sel") + public ModelAndView rt0200Sel(HttpServletRequest req, Model model){ ModelAndView mav = new ModelAndView(); mav.addObject("searchCodeList", rt0200Service.findSndngProcessSttus()); return mav; @@ -71,39 +73,20 @@ public class Rt0200Controller { */ //@GetMapping(value = "finds") //@GetMapping(value = "finds", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - @RequestMapping(value = "/findRt0200List", method = {RequestMethod.GET, RequestMethod.POST}) + @GetMapping(value = "/findRt0200List") public ModelAndView findRt0200List(@RequestParam Map paramMap) { return ResultResponse.of(rt0200Service.findRt0200List(paramMap, MybatisUtils.getPagingInfo(paramMap))); } + /* + @GetMapping(value = "/findRt0200List2", method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView findRt0200List2(@ModelAttribute Rt0200SearchVO vo) { + return ResultResponse.of(rt0200Service.findRt0200List(vo, MybatisUtils.getPagingInfo(vo))); + } + */ + @GetMapping(value = "/findRt0200") public ModelAndView findRt0200(final String reglt_id) { return ResultResponse.of(rt0200Service.findRt0200(reglt_id)); } - - // /** - // *
메소드 설명: 단건 자료 검색
- // * @param req - // * @return String 요청처리 후 응답객체 - // * @author: 최정민 - // * @date: 2022. 9. 20. - // */ - // @GetMapping(value = "detail") - // public String detail(HttpServletRequest req, Rt0200VO vo, Model model){ - // - // String reglt_id = req.getParameter("selectedId"); - // vo.setReglt_id(reglt_id); - // - // vo = rt0200Service.findView(vo); - // - // model.addAttribute("contents",vo); - // - // return FimsConst.JSP_BASE_PATH - // +"rt/rt0200/Rt0200" - // +"_"+new Object() {}.getClass().getEnclosingMethod().getName() - // +".fims-pop"; //메소드명 - // } - - - } diff --git a/src/main/java/kr/xit/framework/biz/mng/menu/web/ProgramMngController.java b/src/main/java/kr/xit/framework/biz/mng/menu/web/ProgramMngController.java index 62397a49..0f4110c5 100644 --- a/src/main/java/kr/xit/framework/biz/mng/menu/web/ProgramMngController.java +++ b/src/main/java/kr/xit/framework/biz/mng/menu/web/ProgramMngController.java @@ -4,14 +4,13 @@ import java.util.Map; import javax.annotation.Resource; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; 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; import org.springframework.web.servlet.ModelAndView; @@ -19,14 +18,11 @@ import kr.xit.framework.biz.mng.menu.model.ProgramMngVO; import kr.xit.framework.biz.mng.menu.service.ProgramMngService; import kr.xit.framework.core.constants.FrameworkConstants; import kr.xit.framework.core.model.ResultResponse; -import kr.xit.framework.core.validation.XitBeanValidator; -import kr.xit.framework.support.exception.BizRuntimeException; import kr.xit.framework.support.mybatis.MybatisUtils; import kr.xit.framework.support.util.AjaxMessageMapRenderer; import kr.xit.framework.support.util.Checks; import kr.xit.framework.support.util.ValidationError; import kr.xit.framework.support.util.constants.MessageKey; -import kr.xit.framework.support.util.model.FieldErrorDtl; /** * @@ -42,11 +38,8 @@ import kr.xit.framework.support.util.model.FieldErrorDtl; //@RequestMapping(value = "/_mng_/menu/program/") @RequestMapping(value = "/framework/biz/mng/menu") public class ProgramMngController { - @Resource private ProgramMngService programMngService; - @Autowired - private XitBeanValidator beanValidator; @Value("#{prop['Globals.Xit.Pagination.PageUnit']}") private int PAGE_UNIT; @@ -59,7 +52,7 @@ public class ProgramMngController { * @author: 박민규 * @date: 2020. 3. 25. */ - @RequestMapping(value = "/mngProgramMgtForm", method={RequestMethod.GET, RequestMethod.POST}) + @GetMapping(value = "/mngProgramMgtForm") public void mngProgramMgtForm() { } @@ -68,7 +61,7 @@ public class ProgramMngController { * @param progrmFileNm : 변경시 필수 * @return ModelAndView */ - @RequestMapping(value = "/mngProgramMgtPopup", method={RequestMethod.GET, RequestMethod.POST}) + @GetMapping(value = "/mngProgramMgtPopup") public ModelAndView mngProgramMgtPopup(@RequestParam(required = false) String progrmFileNm) { ModelAndView mav = new ModelAndView(); @@ -90,7 +83,7 @@ public class ProgramMngController { */ /*@PostMapping(value = "ProgramMng_list.ajax")*/ - @RequestMapping(value = "/programList", method = {RequestMethod.GET, RequestMethod.POST}) + @GetMapping(value = "/programList") public ModelAndView findPrograms(@RequestParam final Map paramMap) { return ResultResponse.of(programMngService.findPrograms(paramMap, MybatisUtils.getPagingInfo(paramMap))); @@ -110,11 +103,8 @@ public class ProgramMngController { ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); //유효성 확인 - beanValidator.validate("progrmMngVO", programMngVO, bindingResult); - if (bindingResult.hasErrors()) { - FieldErrorDtl fieldErrorDtl = ValidationError.errorList(bindingResult.getFieldErrors()).get(0); - throw BizRuntimeException.create(fieldErrorDtl.getCode(), fieldErrorDtl.getArguments()); - } + ValidationError.of("progrmMngVO", programMngVO, bindingResult); + programMngService.addProgram(programMngVO); AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS); @@ -123,25 +113,21 @@ public class ProgramMngController { /** * 프로그램 변경 - * @param progrmMngVO + * @param programMngVO * @param bindingResult * @return ModelAndView */ @PostMapping(value = "/modifyProgram") public ModelAndView modifyProgram( - @ModelAttribute final ProgramMngVO progrmMngVO + @ModelAttribute final ProgramMngVO programMngVO , final BindingResult bindingResult ) { ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); //유효성 확인 - beanValidator.validate(progrmMngVO, bindingResult); - // beanValidator.validate("progrmMngVO", vo, bindingResult); - if (bindingResult.hasErrors()) { - FieldErrorDtl fieldErrorDtl = ValidationError.errorList(bindingResult.getFieldErrors()).get(0); - throw BizRuntimeException.create(fieldErrorDtl.getCode(), fieldErrorDtl.getArguments()); - } - programMngService.modifyProgram(progrmMngVO); + ValidationError.of("progrmMngVO", programMngVO, bindingResult); + + programMngService.modifyProgram(programMngVO); AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS); return mav; diff --git a/src/main/java/kr/xit/framework/support/util/JBeanRegistry.java b/src/main/java/kr/xit/framework/support/util/JBeanRegistry.java index 08b81158..c90004ed 100644 --- a/src/main/java/kr/xit/framework/support/util/JBeanRegistry.java +++ b/src/main/java/kr/xit/framework/support/util/JBeanRegistry.java @@ -2,9 +2,9 @@ package kr.xit.framework.support.util; import org.springframework.context.MessageSource; import org.springframework.context.support.MessageSourceAccessor; -import org.springframework.validation.Validator; import kr.xit.framework.core.message.XitMessageSource; +import kr.xit.framework.core.validation.XitBeanValidator; /** * 캐시로 관리되는 서비스를 관리한다. @@ -12,8 +12,8 @@ import kr.xit.framework.core.message.XitMessageSource; */ public class JBeanRegistry { - public static final Validator getValidator() { - return (Validator)SpringUtils.getBean(Validator.class); + public static final XitBeanValidator getValidator() { + return (XitBeanValidator)SpringUtils.getBean(XitBeanValidator.class); } /** diff --git a/src/main/java/kr/xit/framework/support/util/ValidationError.java b/src/main/java/kr/xit/framework/support/util/ValidationError.java index 10242ef7..76bbe462 100644 --- a/src/main/java/kr/xit/framework/support/util/ValidationError.java +++ b/src/main/java/kr/xit/framework/support/util/ValidationError.java @@ -3,9 +3,11 @@ package kr.xit.framework.support.util; import java.util.List; import java.util.stream.Collectors; -import org.springframework.validation.Errors; +import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; +import kr.xit.framework.core.validation.XitBeanValidator; +import kr.xit.framework.support.exception.BizRuntimeException; import kr.xit.framework.support.util.model.FieldErrorDtl; import lombok.AllArgsConstructor; import lombok.Getter; @@ -15,7 +17,7 @@ import lombok.Setter; @Setter @AllArgsConstructor public class ValidationError { - private List errors; + private final List errors; public static ValidationError create(List errors){ List dtls = errors.stream() @@ -30,4 +32,14 @@ public class ValidationError { .map(FieldErrorDtl::create) .collect(Collectors.toList()); } + + public static void of(String voName, Object o, BindingResult bindingResult){ + XitBeanValidator validator = JBeanRegistry.getValidator(); + + validator.validate(voName, o, bindingResult); + if (bindingResult.hasErrors()) { + FieldErrorDtl fieldErrorDtl = ValidationError.errorList(bindingResult.getFieldErrors()).get(0); + throw BizRuntimeException.create(fieldErrorDtl.getCode(), fieldErrorDtl.getArguments()); + } + } } diff --git a/src/main/resources/sqlmapper/biz/rt/Rt0200-mysql-mapper.xml b/src/main/resources/sqlmapper/biz/rt/rt0200-mysql-mapper.xml similarity index 94% rename from src/main/resources/sqlmapper/biz/rt/Rt0200-mysql-mapper.xml rename to src/main/resources/sqlmapper/biz/rt/rt0200-mysql-mapper.xml index 98af4e67..04816953 100644 --- a/src/main/resources/sqlmapper/biz/rt/Rt0200-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/biz/rt/rt0200-mysql-mapper.xml @@ -1,9 +1,10 @@ + - + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rtRt0200Sel.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp similarity index 100% rename from src/main/webapp/WEB-INF/jsp/fims/biz/rt/rtRt0200Sel.jsp rename to src/main/webapp/WEB-INF/jsp/fims/biz/rt/rt0200Sel.jsp