@RequestMapping( value = {"/search"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST}) public String doSearch( HttpServletRequest request, @ModelAttribute(value = "roadPumpStatusForm") RoadPumpStatusForm roadPumpStatusForm, BindingResult result, Model model) { String mode = roadPumpStatusForm.getMode(); if (mode != null && mode.equals(IMakeDevUtils.MODE_DELETE)) { pstService.deletePstRoadPumpStatus( roadPumpStatusForm.getPstRoadPumpStatus(), ServiceConstant.PST_ROAD_PUMP_STATUS_DELETE); roadPumpStatusForm.getPaging().setPageNo(1); } else if (mode != null && mode.equals(IMakeDevUtils.MODE_DO_BACK)) { if (model.containsAttribute("roadPumpStatusForm")) roadPumpStatusForm = (RoadPumpStatusForm) model.asMap().get("roadPumpStatusForm"); else roadPumpStatusForm = new RoadPumpStatusForm(); } roadPumpStatusForm.getPaging().setPageSize(IMakeDevUtils.PAGE_SIZE); roadPumpStatusForm.getPstRoadPumpStatus().setPagging(roadPumpStatusForm.getPaging()); VResultMessage vresultMessage = pstService.searchPstRoadPumpStatus(roadPumpStatusForm.getPstRoadPumpStatus()); roadPumpStatusForm.setPageCount( IMakeDevUtils.calculatePage( roadPumpStatusForm.getPaging().getPageSize(), Integer.parseInt(vresultMessage.getMaxRow()))); model.addAttribute("pstRoadPumpStatuss", vresultMessage.getResultListObj()); model.addAttribute("roadPumpStatusForm", roadPumpStatusForm); model.addAttribute("message", ""); return "backoffice/template/roadPumpStatus_search"; }
@RequestMapping( value = {"/action/{section}"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST}) public String doAction( HttpServletRequest request, @PathVariable String section, @ModelAttribute(value = "roadPumpStatusForm") RoadPumpStatusForm roadPumpStatusForm, BindingResult result, Model model) { String mode = roadPumpStatusForm.getMode(); String message = ""; String message_class = ""; Long id = null; if (mode != null) if (mode.equals(IMakeDevUtils.MODE_NEW)) { id = pstService.savePstRoadPumpStatus(roadPumpStatusForm.getPstRoadPumpStatus()); roadPumpStatusForm.getPstRoadPumpStatus().setPrpsId(id); roadPumpStatusForm.setMode(IMakeDevUtils.MODE_EDIT); message = "Save success !"; message_class = "success"; } else if (mode.equals(IMakeDevUtils.MODE_EDIT)) { pstService.updatePstRoadPumpStatus(roadPumpStatusForm.getPstRoadPumpStatus()); id = roadPumpStatusForm.getPstRoadPumpStatus().getPrpsId(); message = "Update success !"; message_class = "success"; } roadPumpStatusForm = new RoadPumpStatusForm(); roadPumpStatusForm.getPaging().setPageSize(IMakeDevUtils.PAGE_SIZE); roadPumpStatusForm.getPstRoadPumpStatus().setPagging(roadPumpStatusForm.getPaging()); VResultMessage vresultMessage = pstService.searchPstRoadPumpStatus(roadPumpStatusForm.getPstRoadPumpStatus()); model.addAttribute("pstRoadPumpStatuss", vresultMessage.getResultListObj()); roadPumpStatusForm.getPaging().setPageSize(IMakeDevUtils.PAGE_SIZE); roadPumpStatusForm.setPageCount( IMakeDevUtils.calculatePage( roadPumpStatusForm.getPaging().getPageSize(), Integer.parseInt(vresultMessage.getMaxRow()))); model.addAttribute("roadPumpStatusForm", roadPumpStatusForm); model.addAttribute("message", message); model.addAttribute("message_class", message_class); return "backoffice/template/roadPumpStatus_search"; }
@RequestMapping( value = {"/init"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}) public String init(Model model) { RoadPumpStatusForm roadPumpStatusForm = new RoadPumpStatusForm(); roadPumpStatusForm.getPaging().setPageSize(IMakeDevUtils.PAGE_SIZE); roadPumpStatusForm.getPstRoadPumpStatus().setPagging(roadPumpStatusForm.getPaging()); VResultMessage vresultMessage = pstService.searchPstRoadPumpStatus(roadPumpStatusForm.getPstRoadPumpStatus()); model.addAttribute("pstRoadPumpStatuss", vresultMessage.getResultListObj()); roadPumpStatusForm.getPaging().setPageSize(IMakeDevUtils.PAGE_SIZE); roadPumpStatusForm.setPageCount( IMakeDevUtils.calculatePage( roadPumpStatusForm.getPaging().getPageSize(), Integer.parseInt(vresultMessage.getMaxRow()))); model.addAttribute("roadPumpStatusForm", roadPumpStatusForm); model.addAttribute("message", ""); return "backoffice/template/roadPumpStatus_search"; }