/** * 查询满足模糊查询条件的记录数 * * @param dbManager DB管理器 * @param conditions 模糊查询条件 * @return 满足模糊查询条件的记录数 * @throws Exception */ public int getCount(DBManager dbManager, String conditions) throws Exception { DBLwTownProrateAppend dbLwTownProrateAppend = new DBLwTownProrateAppend(dbManager); if (conditions.trim().length() == 0) { conditions = "1=1"; } int count = dbLwTownProrateAppend.getCount(conditions); return count; }
/** * 按条件查询多条数据 * * @param dbManager DB管理器 * @param conditions 查询条件 * @param pageNo 页号 * @param rowsPerPage 每页的行数 * @return PageRecord 查询的一页的结果 * @throws Exception */ public PageRecord findByConditions( DBManager dbManager, String conditions, int pageNo, int rowsPerPage) throws Exception { DBLwTownProrateAppend dbLwTownProrateAppend = new DBLwTownProrateAppend(dbManager); Collection collection = new ArrayList(); if (conditions.trim().length() == 0) { conditions = "1=1"; } int count = dbLwTownProrateAppend.getCount(SqlUtils.getWherePartForGetCount(conditions)); collection = dbLwTownProrateAppend.findByConditions(conditions, pageNo, rowsPerPage); PageRecord pageRecord = new PageRecord(count, pageNo, 1, rowsPerPage, collection); return pageRecord; }