diff --git a/src/com/hellogithub/dao/githubDao.java b/src/com/hellogithub/dao/githubDao.java index 0a94188..ff5315d 100644 --- a/src/com/hellogithub/dao/githubDao.java +++ b/src/com/hellogithub/dao/githubDao.java @@ -60,24 +60,17 @@ public class githubDao { return back; } - public ResultSetMetaData ret_Github_info(int projectid) { - List githubEntityList; - ResultSetMetaData rsmd = null; + public githubEntity ret_Github_info(int projectid) { + githubEntity githubEntityList; String sql = "select * from githubinfo WHERE projectId = ?;"; try { Connection conn = JdbcUtils.getConnection(); - PreparedStatement prep = conn.prepareStatement(sql); - ResultSet rs = null; - prep.setInt(1, projectid); - rs = prep.executeQuery(); - while (rs.next()) { - rsmd = rs.getMetaData(); - } - conn.close(); + QueryRunner runner = new QueryRunner(); + githubEntityList = runner.query(conn,sql,new BeanHandler<>(githubEntity.class),projectid); } catch (SQLException e) { throw new RuntimeException(e); } - return rsmd; + return githubEntityList; } } diff --git a/src/com/hellogithub/service/githubService.java b/src/com/hellogithub/service/githubService.java index 8469496..2294612 100644 --- a/src/com/hellogithub/service/githubService.java +++ b/src/com/hellogithub/service/githubService.java @@ -17,7 +17,6 @@ public class githubService { } public String ret_Github_info(int projectId){ - ResultSetMetaData rsmd = githubDao.ret_Github_info(projectId); - return JSONObject.toJSONString(rsmd); + return JSONObject.toJSONString(githubDao.ret_Github_info(projectId)); } }