增加了返回单个项目信息

master
yang.yongquan 2022-07-05 10:57:47 +08:00
parent 12467b6778
commit 9dab2d8e10
1 changed files with 19 additions and 4 deletions

View File

@ -2,6 +2,8 @@ package cn.edu.hfut.rmdjzz.projectmanagement.controller;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
@ -28,6 +30,8 @@ public class ProjectController {
@Autowired
private IProjectService projectService;
@Autowired
private IProjectGroupService projectGroupService;
@ApiOperation("根据Token获取该员工的ProjectList")
@ApiImplicitParams({
@ -45,13 +49,24 @@ public class ProjectController {
return ResponseList.ofSuccess("成功返回列表", result);
}
@SneakyThrows
@GetMapping("/{projectId}")
public ResponseMap getOneProject(
@RequestHeader("Token") String token,
@PathVariable ("projectId") Integer projectId
) {
if(projectGroupService.getUserLevelInGroup(token, projectId) == 0) {
throw new BadRequestException("请求参数错误");
}
return ResponseMap.ofSuccess("查询成功", projectService.getById(projectId));
}
@ApiOperation("根据Token获取该员工的Project数")
@SneakyThrows
@GetMapping("/total")
@GetMapping("/count")
public ResponseMap getProjectNumOfStaff(@RequestHeader("Token") String token) {
Map<String, Long> res = new HashMap<>();
res.put("totalNum", projectService.getAllProjectOfStaff(token));
return ResponseMap.ofSuccess("获得参与项目总数", res);
return ResponseMap.ofSuccess("查询成功")
.put("totalNum", projectService.getAllProjectOfStaff(token));
}
@ApiImplicitParams({