diff --git a/src/com/hellogithub/dao/projectDao.java b/src/com/hellogithub/dao/projectDao.java index 97098ac..d5c3380 100644 --- a/src/com/hellogithub/dao/projectDao.java +++ b/src/com/hellogithub/dao/projectDao.java @@ -24,7 +24,7 @@ public class projectDao { try { Connection conn = JdbcUtils.getConnection(); QueryRunner runner = new QueryRunner(); - String sql = "select * from project where periodicals = ? and isValid = 1ORDER BY categoryId"; + String sql = "select * from project where periodicals = ? and isValid = 1 ORDER BY categoryId"; projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class), num); conn.close(); } catch (SQLException e) { @@ -61,7 +61,7 @@ public class projectDao { try { Connection conn = JdbcUtils.getConnection(); QueryRunner runner = new QueryRunner(); - String sql = "select count(*) as num from project where isValid = 1"; + String sql = "select count(*) as num from project"; p = runner.query(conn, sql, new BeanHandler<>(projectEntity.class)); count = p.getNum(); conn.close(); diff --git a/src/com/hellogithub/service/projectService.java b/src/com/hellogithub/service/projectService.java index f605a27..0efaf10 100644 --- a/src/com/hellogithub/service/projectService.java +++ b/src/com/hellogithub/service/projectService.java @@ -14,7 +14,7 @@ import java.util.*; public class projectService { - private projectDao projectDao = new projectDao(); + private static projectDao projectDao = new projectDao(); private categoryDao categoryDao = new categoryDao(); /** * 按照期刊号查询 @@ -27,12 +27,10 @@ public class projectService { String now =null; for(int i =0;i(); } projectEntityListTem.add(projectEntity); - } return JSONObject.toJSONString(dataMap); @@ -181,4 +178,5 @@ public class projectService { List projectEntityList = projectDao.retProjectByUserId(id); return JSONObject.toJSONString(projectEntityList); } + } \ No newline at end of file diff --git a/src/com/hellogithub/servlet/retLabelServlet.java b/src/com/hellogithub/servlet/retLabelServlet.java index 34b3bb4..6b356da 100644 --- a/src/com/hellogithub/servlet/retLabelServlet.java +++ b/src/com/hellogithub/servlet/retLabelServlet.java @@ -37,7 +37,6 @@ public class retLabelServlet extends HttpServlet { resp.setHeader("Access-Control-Max-Age", "3600"); resp.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With"); resp.setContentType("application/json;charset=UTF-8"); - PrintWriter writer = resp.getWriter(); String jsonString = JSONObject.toJSONString(categoryService.retLabel()); writer.println(jsonString); diff --git a/src/com/hellogithub/servlet/selectByInputServlet.java b/src/com/hellogithub/servlet/selectByInputServlet.java index a15555a..b8b0737 100644 --- a/src/com/hellogithub/servlet/selectByInputServlet.java +++ b/src/com/hellogithub/servlet/selectByInputServlet.java @@ -22,7 +22,7 @@ public class selectByInputServlet extends HttpServlet { private com.hellogithub.service.projectService projectService=new projectService(); private UserService userService = new UserService(); @Override - public void init(ServletConfig config) throws ServletException { + public void init(ServletConfig config) throws ServletException{ } diff --git a/src/com/hellogithub/servlet/selectTermServlet.java b/src/com/hellogithub/servlet/selectTermServlet.java index 521cccc..ae1820a 100644 --- a/src/com/hellogithub/servlet/selectTermServlet.java +++ b/src/com/hellogithub/servlet/selectTermServlet.java @@ -39,7 +39,7 @@ public class selectTermServlet extends HttpServlet { resp.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With"); resp.setContentType("application/json;charset=UTF-8"); //按照分类返回期刊 - String num = req.getParameter("id"); + String num = req.getParameter("type"); PrintWriter writer = resp.getWriter(); writer.println(projectService.retTerm(num)); // setResultOK("123",writer);