更新
This commit is contained in:
@@ -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();
|
||||
|
@@ -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<projectEntityList.size();i++)
|
||||
{
|
||||
|
||||
projectEntity projectEntity = projectEntityList.get(i);
|
||||
categoryEntity categoryEntity = categoryDao.retNum(projectEntity.getCategoryId());
|
||||
projectEntity.setCategoryName(categoryEntity.getCategoryName());
|
||||
now =projectEntity.getCategoryName();
|
||||
|
||||
if(i == 0) tem = now;
|
||||
if(!tem.equals(now)){
|
||||
tem=now;
|
||||
@@ -40,7 +38,6 @@ public class projectService {
|
||||
projectEntityListTem = new ArrayList<>();
|
||||
}
|
||||
projectEntityListTem.add(projectEntity);
|
||||
|
||||
}
|
||||
return JSONObject.toJSONString(dataMap);
|
||||
|
||||
@@ -181,4 +178,5 @@ public class projectService {
|
||||
List<projectEntity> projectEntityList = projectDao.retProjectByUserId(id);
|
||||
return JSONObject.toJSONString(projectEntityList);
|
||||
}
|
||||
|
||||
}
|
@@ -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);
|
||||
|
@@ -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{
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user