@Override public List<RequestForm> queryCSNoForManagerSearch(RequestForm requestForm) { StringBuilder sql = new StringBuilder(); List<String> strList = new ArrayList<String>(); String strSql = ""; sql.append(" SELECT "); sql.append(" request_form_id, request_cs_no, request_form_status, request_date "); sql.append(" FROM pea_request_form "); sql.append(" WHERE 1 = 1 "); if (StringUtils.isNotEmpty(requestForm.getRequestCSNo())) { sql.append(" AND request_cs_no LIKE '%" + requestForm.getRequestCSNo() + "%' "); } if (StringUtils.isNotEmpty(requestForm.getChkNewStatus())) { strList.add("'" + requestForm.getChkNewStatus() + "'"); } if (StringUtils.isNotEmpty(requestForm.getChkSurveyStatus())) { strList.add("'" + requestForm.getChkSurveyStatus() + "'"); } if (StringUtils.isNotEmpty(requestForm.getChkMeterStatus())) { strList.add("'" + requestForm.getChkMeterStatus() + "'"); } if (StringUtils.isNotEmpty(requestForm.getChkEndStatus())) { strList.add("'" + requestForm.getChkEndStatus() + "'"); } if (StringUtils.isNotEmpty(requestForm.getChkNewStatus()) || StringUtils.isNotEmpty(requestForm.getChkSurveyStatus()) || StringUtils.isNotEmpty(requestForm.getChkMeterStatus()) || StringUtils.isNotEmpty(requestForm.getChkEndStatus())) { for (int i = 0; i < strList.size(); i++) { strSql = strSql + strList.get(i); if (strList.size() >= 2 && i + 1 < strList.size()) { strSql = strSql + ", "; } } System.out.println(strSql); sql.append(" AND request_form_status IN (" + strSql + ") "); } sql.append(" ORDER BY request_date DESC "); sql.append(" LIMIT 0, 7 "); List<RequestForm> requestFormList = this.executeQuery(sql.toString(), csNoMapper); return requestFormList; }
@RequestMapping( value = {"/search.htm"}, method = RequestMethod.POST) public ModelAndView search(@ModelAttribute RequestForm requestForm) { logger.info(" Start Search GET "); ModelAndView mav = new ModelAndView(); mav.setViewName("peaMeterIndex"); mav.addObject("requestForm", requestForm); List<RequestForm> requestFormList = peaMeterService.queryCSNoForMeterSearch(requestForm.getRequestCSNo()); mav.addObject("requestFormList", requestFormList); return mav; }