改bug
This commit is contained in:
@@ -56,11 +56,13 @@ public class projectDao {
|
|||||||
*/
|
*/
|
||||||
public int countAll() {
|
public int countAll() {
|
||||||
int count;
|
int count;
|
||||||
|
projectEntity p;
|
||||||
try {
|
try {
|
||||||
Connection conn = JdbcUtils.getConnection();
|
Connection conn = JdbcUtils.getConnection();
|
||||||
QueryRunner runner = new QueryRunner();
|
QueryRunner runner = new QueryRunner();
|
||||||
String sql = "select count(1) from project";
|
String sql = "select count(*) as projectId from project";
|
||||||
count = runner.query(conn, sql, new BeanHandler<>(Integer.class));
|
p = runner.query(conn, sql, new BeanHandler<>(projectEntity.class));
|
||||||
|
count = p.getProjectId();
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -118,7 +120,7 @@ public class projectDao {
|
|||||||
try {
|
try {
|
||||||
Connection conn = JdbcUtils.getConnection();
|
Connection conn = JdbcUtils.getConnection();
|
||||||
QueryRunner runner = new QueryRunner();
|
QueryRunner runner = new QueryRunner();
|
||||||
String sql = "select * from project where projectId in (select projectId from project_category where categoryId=?) order by lookCount";
|
String sql = "select * from project where projectId in (select projectId from project_category where categoryId=?) order by lookCount desc";
|
||||||
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class),cateid);
|
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class),cateid);
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
Reference in New Issue
Block a user