@Test public void testQueryCount() { deleteAll(); insertOne(1); Query<Domain> q = createTestQuery(); int c = q.count(); Assert.assertEquals(1, c); }
public int count() { String queryTemp = removeOrderBy(getSql()); if (!queryTemp.startsWith("select")) { if (queryTemp.startsWith("!!with")) { int i = queryTemp.indexOf("!!select"); int y = queryTemp.indexOf("!!from"); String toReplace = queryTemp.substring(i, y); queryTemp = queryTemp.replace(toReplace, "select count(*) ").replace("!!", ""); } else { queryTemp = "select count(*) " + queryTemp; } } else { queryTemp = "select count(*) " + removeSelect(queryTemp); } return this.jdbcTemplate.queryForObject(queryTemp, this.sqlArgs.toArray(), Integer.class); }
SpringJdbcQuery implements cn.bc.core.query.Query<T> { public int count() { String queryTemp = removeOrderBy(getSql()); if (!queryTemp.startsWith("select")) { if (queryTemp.startsWith("!!with")) { int i = queryTemp.indexOf("!!select"); int y = queryTemp.indexOf("!!from"); String toReplace = queryTemp.substring(i, y); queryTemp = queryTemp.replace(toReplace, "select count(*) ").replace("!!", ""); } else { queryTemp = "select count(*) " + queryTemp; } } else { queryTemp = "select count(*) " + removeSelect(queryTemp); } return this.jdbcTemplate.queryForObject(queryTemp, this.sqlArgs.toArray(), Integer.class); } }
SpringJdbcQuery implements cn.bc.core.query.Query<T> { public int count() { String queryTemp = removeOrderBy(getSql()); if (!queryTemp.startsWith("select")) { if (queryTemp.startsWith("!!with")) { int i = queryTemp.indexOf("!!select"); int y = queryTemp.indexOf("!!from"); String toReplace = queryTemp.substring(i, y); queryTemp = queryTemp.replace(toReplace, "select count(*) ").replace("!!", ""); } else { queryTemp = "select count(*) " + queryTemp; } } else { queryTemp = "select count(*) " + removeSelect(queryTemp); } return this.jdbcTemplate.queryForObject(queryTemp, this.sqlArgs.toArray(), Integer.class); } private  SpringJdbcQuery();  SpringJdbcQuery(DataSource dataSource, RowMapper<T> rowMapper); }
SpringJdbcQuery implements cn.bc.core.query.Query<T> { public int count() { String queryTemp = removeOrderBy(getSql()); if (!queryTemp.startsWith("select")) { if (queryTemp.startsWith("!!with")) { int i = queryTemp.indexOf("!!select"); int y = queryTemp.indexOf("!!from"); String toReplace = queryTemp.substring(i, y); queryTemp = queryTemp.replace(toReplace, "select count(*) ").replace("!!", ""); } else { queryTemp = "select count(*) " + queryTemp; } } else { queryTemp = "select count(*) " + removeSelect(queryTemp); } return this.jdbcTemplate.queryForObject(queryTemp, this.sqlArgs.toArray(), Integer.class); } private  SpringJdbcQuery();  SpringJdbcQuery(DataSource dataSource, RowMapper<T> rowMapper); void setSqlArgs(List<Object> sqlArgs); SpringJdbcQuery<T> setSql(String sql); cn.bc.core.query.Query<T> condition(
    cn.bc.core.query.condition.Condition condition); int count(); T singleResult(); List<T> list(); List<T> list(int pageNo, int pageSize); Page<T> page(int pageNo, int pageSize); List<Object> listWithSelect(String select); }
SpringJdbcQuery implements cn.bc.core.query.Query<T> { public int count() { String queryTemp = removeOrderBy(getSql()); if (!queryTemp.startsWith("select")) { if (queryTemp.startsWith("!!with")) { int i = queryTemp.indexOf("!!select"); int y = queryTemp.indexOf("!!from"); String toReplace = queryTemp.substring(i, y); queryTemp = queryTemp.replace(toReplace, "select count(*) ").replace("!!", ""); } else { queryTemp = "select count(*) " + queryTemp; } } else { queryTemp = "select count(*) " + removeSelect(queryTemp); } return this.jdbcTemplate.queryForObject(queryTemp, this.sqlArgs.toArray(), Integer.class); } private  SpringJdbcQuery();  SpringJdbcQuery(DataSource dataSource, RowMapper<T> rowMapper); void setSqlArgs(List<Object> sqlArgs); SpringJdbcQuery<T> setSql(String sql); cn.bc.core.query.Query<T> condition(
    cn.bc.core.query.condition.Condition condition); int count(); T singleResult(); List<T> list(); List<T> list(int pageNo, int pageSize); Page<T> page(int pageNo, int pageSize); List<Object> listWithSelect(String select);  }