예제 #1
0
  /** 分页查询所有的管理员 */
  public PageModel<AdminUserInfo> queryAll(int pageNo) {
    String sql =
        "SELECT adminuserinfo.*,NAME as areaName FROM adminuserinfo JOIN provincialinfo ON adminuserinfo.areaId = provincialinfo.provincialID WHERE LEVEL= 1"
            + " UNION SELECT adminuserinfo.*,NAME FROM adminuserinfo JOIN cityinfo ON adminuserinfo.areaId = cityinfo.cityId WHERE LEVEL= 2"
            + " UNION SELECT adminuserinfo.*,NAME FROM adminuserinfo JOIN countyinfo ON adminuserinfo.areaId = countyinfo.countyID WHERE LEVEL= 3";
    PageModel<AdminUserInfo> pm = new PageModel<AdminUserInfo>();

    pm.setSumCount(querySumCount());

    pm.setCurrentPage(pageNo);

    sql += "  ORDER BY id DESC limit " + (pageNo - 1) * pm.getSize() + "," + pm.getSize();

    List<AdminUserInfo> list = DBHelper.commQuery(sql, AdminUserInfo.class);

    pm.setData(list);

    return pm;
  }
예제 #2
0
  /**
   * 返回用户列表
   *
   * @param pageNo 页数
   * @param name 查询关键字
   * @return
   */
  public PageModel<Userinfo> getUserInfoList(int pageNo, String keyword) {

    PageModel<Userinfo> pm = new PageModel<Userinfo>();

    pm.setSumCount(getCountyCount(keyword));

    pm.setCurrentPage(pageNo);

    String sql = "select * from userinfo where username like ?"; // 默认表示全国

    sql += " order by checkin desc";

    sql += " limit " + ((pageNo - 1) * pm.getSize() + "," + pm.getSize());

    List<Userinfo> list = DBHelper.commQuery(sql, Userinfo.class, keyword);

    pm.setData(list);

    return pm;
  }