Example #1
0
  @Override
  public Page<Map> listAsMap(SearchConditions searchCondition, int pageNo, int pageSize) {

    Map<SearchKey, Object> conditions = searchCondition.getConditions();
    int size = conditions.size();
    Object[] args = new Object[size];

    // 导入用户信息,可能没有关联机房信息
    String sqlFetch = "select * from  zytj  where 1=1 ";
    String sqlCount = "select count(*) from zytj where 1=1 ";
    int i = 0;
    for (SearchKey searchKey : conditions.keySet()) {
      args[i++] = conditions.get(searchKey);

      String theta = searchKey.getTheta();
      String field = searchKey.getField();
      sqlFetch += " and " + field + " " + theta + " ? ";
      sqlCount += " and " + field + " " + theta + " ? ";

      if (theta.equals("like")) {
        args[i - 1] = "%" + args[i - 1].toString() + "%";
      }
    }

    return this.phoneBaseDao.listAsMap(sqlCount, sqlFetch, args, pageNo, pageSize);
  }
Example #2
0
  public List<Map> listAllAsMap(SearchConditions searchCondition) {
    Map<SearchKey, Object> conditions = searchCondition.getConditions();
    int size = conditions.size();
    Object[] args = new Object[size];
    String sqlFetch = "select * from  zytj  where 1=1 ";
    int i = 0;
    for (SearchKey searchKey : conditions.keySet()) {
      args[i++] = conditions.get(searchKey);

      String theta = searchKey.getTheta();
      String field = searchKey.getField();
      sqlFetch += " and " + field + " " + theta + " ? ";

      if (theta.equals("like")) {
        args[i - 1] = "%" + args[i - 1].toString() + "%";
      }
    }

    return this.phoneBaseDao.listAllAsMap(sqlFetch, args);
  }