改bug
This commit is contained in:
@@ -126,19 +126,20 @@ public class projectDao {
|
||||
}
|
||||
return projectEntityList;
|
||||
}
|
||||
public List<projectEntity> retMostStar(){
|
||||
public List<projectEntity> retMostStar(String id ){
|
||||
List<projectEntity> projectEntityList;
|
||||
try {
|
||||
Connection conn = JdbcUtils.getConnection();
|
||||
QueryRunner runner = new QueryRunner();
|
||||
String sql = "select * from project order by startNum desc";
|
||||
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class));
|
||||
String sql = "select * from project where projectId = ? order by startNum desc";
|
||||
projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class),id);
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return projectEntityList;
|
||||
}
|
||||
//搜索框
|
||||
public List<projectEntity> selectByInput(String str) {
|
||||
List<projectEntity> projectEntityList;
|
||||
try {
|
||||
@@ -152,4 +153,18 @@ public class projectDao {
|
||||
}
|
||||
return projectEntityList;
|
||||
}
|
||||
//返回标签
|
||||
// public List<> retLabelBy(String str) {
|
||||
// List<projectEntity> projectEntityList;
|
||||
// try {
|
||||
// Connection conn = JdbcUtils.getConnection();
|
||||
// QueryRunner runner = new QueryRunner();
|
||||
// String sql = "SELECT * FROM project WHERE projectName LIKE %?%";
|
||||
// projectEntityList = runner.query(conn, sql, new BeanListHandler<>(projectEntity.class), str);
|
||||
// conn.close();
|
||||
// } catch (SQLException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// return ;
|
||||
// }
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ public class projectService {
|
||||
}
|
||||
return projectEntityList;
|
||||
}
|
||||
public List<projectEntity> retSelcetByStar(int cate){
|
||||
public List<projectEntity> retSelcetByStar(int cate,String id){
|
||||
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();
|
||||
projectEntityList =projectDao.retMostStar(id);
|
||||
for(int i =0;i<projectEntityList.size();i++)
|
||||
{
|
||||
|
||||
|
@@ -39,8 +39,9 @@ public class selectMostStarServlet extends HttpServlet {
|
||||
resp.setContentType("application/json;charset=UTF-8");
|
||||
|
||||
String cate = req.getParameter("xxxxxxx");
|
||||
String id = req.getParameter("xxxxx");
|
||||
PrintWriter writer = resp.getWriter();
|
||||
String jsonString = JSONObject.toJSONString(projectService.retSelcetByStar(Integer.valueOf(cate)));
|
||||
String jsonString = JSONObject.toJSONString(projectService.retSelcetByStar(Integer.valueOf(cate),id));
|
||||
writer.println(jsonString);
|
||||
writer.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user