更新项目详情
This commit is contained in:
@@ -5,7 +5,10 @@ import com.hellogithub.dao.categoryDao;
|
|||||||
import com.hellogithub.dao.projectDao;
|
import com.hellogithub.dao.projectDao;
|
||||||
import com.hellogithub.entity.categoryEntity;
|
import com.hellogithub.entity.categoryEntity;
|
||||||
import com.hellogithub.entity.projectEntity;
|
import com.hellogithub.entity.projectEntity;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class projectService {
|
public class projectService {
|
||||||
@@ -126,7 +129,14 @@ public class projectService {
|
|||||||
public int addProjectLookcount(String id ){
|
public int addProjectLookcount(String id ){
|
||||||
return projectDao.addProjectLookcount(id);
|
return projectDao.addProjectLookcount(id);
|
||||||
}
|
}
|
||||||
public List<categoryEntity> retProjectLabel(String id ){
|
public String retProjectLabel(String id ){
|
||||||
return projectDao.retProjectLabel(id);
|
Map<String,String > dataMap = new HashMap<>();
|
||||||
|
List<categoryEntity> categoryEntityList = projectDao.retProjectLabel(id);
|
||||||
|
for(int i=0;i<categoryEntityList.size();i++)
|
||||||
|
{
|
||||||
|
categoryEntity categoryEntity=categoryEntityList.get(i);
|
||||||
|
dataMap.put("CategoryName",categoryEntity.getCategoryName());
|
||||||
|
}
|
||||||
|
return dataMap.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
package com.hellogithub.servlet;
|
package com.hellogithub.servlet;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hellogithub.service.projectService;
|
import com.hellogithub.service.projectService;
|
||||||
import jakarta.servlet.ServletConfig;
|
import jakarta.servlet.ServletConfig;
|
||||||
@@ -37,15 +38,14 @@ public class selectProByIdServlet extends HttpServlet {
|
|||||||
resp.setHeader("Access-Control-Max-Age", "3600");
|
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.setHeader("Access-Control-Allow-Headers", "access-control-allow-origin, authority, content-type, version-info, X-Requested-With");
|
||||||
resp.setContentType("application/json;charset=UTF-8");
|
resp.setContentType("application/json;charset=UTF-8");
|
||||||
//按照分类返回期刊
|
|
||||||
String id = req.getParameter("id");
|
String id = req.getParameter("id");
|
||||||
int num = projectService.addProjectLookcount(id);
|
int num = projectService.addProjectLookcount(id);
|
||||||
|
|
||||||
PrintWriter writer = resp.getWriter();
|
PrintWriter writer = resp.getWriter();
|
||||||
String jsonString = JSONObject.toJSONString(projectService.selectProById(id));
|
String dataMap = projectService.retProjectLabel(id);
|
||||||
String jsonString1 = JSONObject.toJSONString(projectService.retProjectLabel(id));
|
JSONObject jsonObject = JSON.parseObject(dataMap);
|
||||||
writer.println(jsonString);
|
jsonObject.put("project",projectService.selectProById(id));
|
||||||
writer.println(jsonString1);
|
writer.println(JSONObject.toJSONString(jsonObject));
|
||||||
if(num == 0 ){
|
if(num == 0 ){
|
||||||
setResult(200, "观看量增加失败", writer);
|
setResult(200, "观看量增加失败", writer);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user