改bug
This commit is contained in:
@@ -50,7 +50,7 @@ public class projectDao {
|
|||||||
return projectEntity.getPeriodicals();
|
return projectEntity.getPeriodicals();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 返回最所有项目总数
|
* 返回所有项目总数
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -118,7 +118,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 startNum";
|
String sql = "select * from project where projectId in (select projectId from project_category where categoryId=?) order by lookCount";
|
||||||
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) {
|
||||||
@@ -126,13 +126,13 @@ public class projectDao {
|
|||||||
}
|
}
|
||||||
return projectEntityList;
|
return projectEntityList;
|
||||||
}
|
}
|
||||||
public List<projectEntity> retMostStar(String id ){
|
public List<projectEntity> retMostStar( ){
|
||||||
List<projectEntity> projectEntityList;
|
List<projectEntity> projectEntityList;
|
||||||
try {
|
try {
|
||||||
Connection conn = JdbcUtils.getConnection();
|
Connection conn = JdbcUtils.getConnection();
|
||||||
QueryRunner runner = new QueryRunner();
|
QueryRunner runner = new QueryRunner();
|
||||||
String sql = "select * from project where categoryId = ? order by lookCount desc";
|
String sql = "select * from project order by lookCount desc";
|
||||||
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class),id);
|
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class));
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@@ -109,7 +109,7 @@ public class projectService {
|
|||||||
}
|
}
|
||||||
return projectEntityList;
|
return projectEntityList;
|
||||||
}
|
}
|
||||||
public List<projectEntity> retSelcetByStar(int cate,String id){
|
public List<projectEntity> retSelcetByStar(int cate){
|
||||||
Map<Integer,String> dataMap=new HashMap<>();
|
Map<Integer,String> dataMap=new HashMap<>();
|
||||||
dataMap.put(1,"C项目");
|
dataMap.put(1,"C项目");
|
||||||
dataMap.put(2,"C#项目");
|
dataMap.put(2,"C#项目");
|
||||||
@@ -131,7 +131,7 @@ public class projectService {
|
|||||||
List<projectEntity> projectEntityList;
|
List<projectEntity> projectEntityList;
|
||||||
|
|
||||||
if (cate == 0){
|
if (cate == 0){
|
||||||
projectEntityList =projectDao.retMostStar(id);
|
projectEntityList =projectDao.retMostStar();
|
||||||
for(int i =0;i<projectEntityList.size();i++)
|
for(int i =0;i<projectEntityList.size();i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -39,9 +39,9 @@ public class selectMostStarServlet extends HttpServlet {
|
|||||||
resp.setContentType("application/json;charset=UTF-8");
|
resp.setContentType("application/json;charset=UTF-8");
|
||||||
|
|
||||||
String cate = req.getParameter("num");
|
String cate = req.getParameter("num");
|
||||||
String id = req.getParameter("index");
|
|
||||||
PrintWriter writer = resp.getWriter();
|
PrintWriter writer = resp.getWriter();
|
||||||
String jsonString = JSONObject.toJSONString(projectService.retSelcetByStar(Integer.valueOf(cate),id));
|
String jsonString = JSONObject.toJSONString(projectService.retSelcetByStar(Integer.valueOf(cate)));
|
||||||
writer.println(jsonString);
|
writer.println(jsonString);
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user