@Override
 public PagingLoadResult<GWTExecuteSetExecutePlan> GetExecuteSetExecutePlanList(
     String execPlanID, String systemID, String searchKey, PagingLoadConfig config) {
   // TODO Auto-generated method stub
   try {
     int count;
     List<ExecuteSetExecutePlan> lst;
     List<Op> ops = new ArrayList<Op>();
     ops.add(Op.EQ(GWTExecuteSetExecutePlan.N_SystemID, systemID));
     if (!execPlanID.isEmpty()) {
       ops.add(Op.EQ(GWTExecuteSetExecutePlan.N_ExecutePlanID, Integer.parseInt(execPlanID)));
     }
     Op[] condition = new Op[ops.size()];
     for (int i = 0; i < ops.size(); i++) { // 把集合类转成数组
       condition[i] = ops.get(i);
     }
     if (searchKey.isEmpty()) {
       count = esExecutePlanDAL.Count(condition);
       PageStartEnd pse = new PageStartEnd(config, count);
       lst =
           esExecutePlanDAL.List(
               GWTExecuteSetExecutePlan.N_ID, true, pse.getStart(), pse.getEnd(), condition);
     } else {
       String[] searchField = new String[] {};
       count = esExecutePlanDAL.MatchCount(searchKey, searchField, condition);
       PageStartEnd pse = new PageStartEnd(config, count);
       lst =
           esExecutePlanDAL.Match(searchKey, searchField, pse.getStart(), pse.getEnd(), condition);
     }
     List<GWTExecuteSetExecutePlan> result = new ArrayList<GWTExecuteSetExecutePlan>();
     for (ExecuteSetExecutePlan data : lst) {
       result.add(BeanToModel(data));
     }
     return new BasePagingLoadResult<GWTExecuteSetExecutePlan>(result, config.getOffset(), count);
   } catch (Exception e) {
     log.error(e, e);
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 2
0
  @Override
  public PagingLoadResult<GWTRecordedCase> GetGWTRecordedCasePageList(
      String sysId, String searchKey, PagingLoadConfig config) {

    try {
      List<GWTRecordedCase> returnList = new ArrayList<GWTRecordedCase>();
      Op[] conditions;
      int count;
      List<RecordedCase> lst;

      List<Op> conList = new ArrayList<Op>();
      conList.add(Op.EQ("systemId", Integer.parseInt(sysId)));
      if (config.get("date") != null) {
        String date = config.get("date");
        conList.add(Op.LIKE("createTime", date));
      }
      if (config.get("reponseFlag") != null) {
        if (!config.get("reponseFlag").equals("-1")) {
          conList.add(
              Op.EQ(
                  GWTRecordedCase.N_ResponseFlag,
                  Integer.parseInt(config.get("reponseFlag").toString())));
        }
      }
      if (config.get("isCased") != null) {
        if (!config.get("isCased").equals("-1")) {
          conList.add(
              Op.EQ(GWTRecordedCase.N_IsCased, Integer.parseInt(config.get("isCased").toString())));
        }
      }
      if (config.get("user") != null) {
        if (!config.get("user").equals("-1")) {
          conList.add(Op.EQ("recordUserId", Integer.parseInt(config.get("user").toString())));
        }
      }

      conditions = new Op[conList.size()];
      for (int i = 0; i < conList.size(); i++) {
        conditions[i] = conList.get(i);
      }

      if (searchKey.isEmpty()) {
        count = dataDao.Count(conditions);
        PageStartEnd pse = new PageStartEnd(config, count);
        lst = dataDao.List(pse.getStart(), pse.getEnd(), conditions);
      } else {
        String[] properties = {"requestMsg", "responseMsg", GWTRecordedCase.N_Memo};
        count = dataDao.MatchCount(searchKey, properties, conditions);
        PageStartEnd pse = new PageStartEnd(config, count);
        lst = dataDao.Match(searchKey, properties, pse.getStart(), pse.getEnd(), conditions);
      }

      for (RecordedCase recrdCase : lst) {
        if (recrdCase != null) returnList.add(BeanToModel(recrdCase));
      }

      return new BasePagingLoadResult<GWTRecordedCase>(returnList, config.getOffset(), count);
    } catch (Exception ex) {
      log.error(ex, ex);
      throw new RuntimeException(ex);
    }
  }