This commit is contained in:
cyk
2023-07-01 12:34:32 +08:00
parent 4e6bce2ec5
commit 87f1743b9c
3 changed files with 9 additions and 9 deletions

View File

@@ -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);

View File

@@ -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++)
{

View File

@@ -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();
}