コード例 #1
0
ファイル: PEAManagerDaoImpl.java プロジェクト: baiwa/pea
 @Override
 public RequestForm mapRow(ResultSet rs, int rowNum) throws SQLException {
   RequestForm requestForm = new RequestForm();
   requestForm.setRequestFormId(rs.getLong("request_form_id"));
   requestForm.setRequestCSNo(rs.getString("request_cs_no"));
   requestForm.setRequestFormStatus(rs.getString("request_form_status"));
   requestForm.setRequestDate(rs.getDate("request_date"));
   return requestForm;
 }
コード例 #2
0
ファイル: PEAMeterController.java プロジェクト: baiwa/pea
  @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;
  }
コード例 #3
0
ファイル: PEAMeterController.java プロジェクト: baiwa/pea
  @RequestMapping(value = "/edit.htm", method = RequestMethod.POST)
  public ModelAndView edit(@ModelAttribute RequestForm requestForm, BindingResult result) {
    logger.info(" Start edit Post ");
    ModelAndView mav = new ModelAndView();

    try {
      requestForm = new RequestFormValidator().validate(requestForm, result);
      if (result.hasErrors()) {
        mav.setViewName("peaMeterForm");
      } else {

        requestForm.setRequestFormStatus(BuckwaConstants.END_STATUS);

        peaMeterService.insertMeter(requestForm);
        mav.addObject("requestFormList", peaMeterService.queryIdForMeterList());
        mav.setViewName("peaMeterIndex");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return mav;
  }
コード例 #4
0
ファイル: PEAManagerDaoImpl.java プロジェクト: baiwa/pea
  @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;
  }