根据项目id查找项目成员id,无查询权限检测
parent
83d95b1227
commit
4e4bd33e1c
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
||||||
|
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 史鹏辉
|
||||||
|
* @since 2022/7/5 9:32
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/project/{projectId}/group")
|
||||||
|
public class ProjectGroupController {
|
||||||
|
@Autowired
|
||||||
|
private IProjectGroupService projectGroupService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseList<Integer> getGroupNumber(@PathVariable Integer projectId) {
|
||||||
|
List<Integer> res = null;
|
||||||
|
try {
|
||||||
|
res = projectGroupService.findAllProjectNumber(projectId);
|
||||||
|
} catch (BadRequestException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return ResponseList.ofSuccess("查询成功", res);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
||||||
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 张韬
|
* @author 张韬
|
||||||
* created at 2022/6/30 21:34
|
* created at 2022/6/30 21:34
|
||||||
*/
|
*/
|
||||||
public interface ProjectGroupMapper extends BaseMapper<ProjectGroup> {
|
public interface ProjectGroupMapper extends BaseMapper<ProjectGroup> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
||||||
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 张韬
|
* @author 张韬
|
||||||
* created at 2022/6/30 21:36
|
* created at 2022/6/30 21:36
|
||||||
|
@ -14,4 +17,6 @@ public interface IProjectGroupService extends IService<ProjectGroup> {
|
||||||
* @return 如果不存在就返回0,否则返回AccessLevel
|
* @return 如果不存在就返回0,否则返回AccessLevel
|
||||||
*/
|
*/
|
||||||
Integer getUserLevelInGroup(String token, Integer projectId);
|
Integer getUserLevelInGroup(String token, Integer projectId);
|
||||||
|
|
||||||
|
List<Integer> findAllProjectNumber(Integer projectId) throws BadRequestException;
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
||||||
|
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectGroupMapper;
|
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectGroupMapper;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
||||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
|
||||||
|
@ -8,6 +10,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 张韬
|
* @author 张韬
|
||||||
* created at 2022/6/30 21:38
|
* created at 2022/6/30 21:38
|
||||||
|
@ -41,4 +46,16 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Integer> findAllProjectNumber(Integer projectId) throws BadRequestException {
|
||||||
|
List<Integer> res= new ArrayList<>();
|
||||||
|
List<ProjectGroup> targetProject = baseMapper.selectList(Wrappers.<ProjectGroup>lambdaQuery().eq(ProjectGroup::getProjectId, projectId));
|
||||||
|
if(targetProject.size() == 0)
|
||||||
|
throw new BadRequestException("项目不存在");
|
||||||
|
for (int i = 0; i < targetProject.size(); i++) {
|
||||||
|
res.add(targetProject.get(i).getStaffId());
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue