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