完成了Task的间接拥有权限检测
parent
1df322ecbe
commit
f7a420ca73
|
@ -13,4 +13,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface ITaskService extends IService<Task> {
|
||||
List<Task> getTaskList(String token,Integer projectId,Integer fatherId) throws BadRequestException;
|
||||
Boolean checkHolder(Integer staffId,Integer taskId);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 张韬
|
||||
|
@ -29,6 +30,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
if(projectGroupServiceImpl.getUserLevelInGroup(token,projectId)==0||fatherId==null){
|
||||
throw new BadRequestException("错误的访问参数");
|
||||
}
|
||||
return baseMapper.selectList(Wrappers.<Task>lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId));
|
||||
return baseMapper.selectList(Wrappers.<Task>lambdaQuery().eq(Task::getTaskProjectId,projectId).eq(Task::getTaskFatherId,fatherId).eq(Task::getDeleted,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkHolder(Integer staffId,Integer taskId){
|
||||
try{
|
||||
Task task=baseMapper.selectOne(Wrappers.<Task>lambdaQuery().eq(Task::getTaskId,taskId));
|
||||
if(task==null||staffId<=0)
|
||||
return false;
|
||||
while(task.getTaskFatherId()!=0){
|
||||
if(Objects.equals(task.getTaskHolderId(), staffId))
|
||||
return true;
|
||||
task=baseMapper.selectOne(Wrappers.<Task>lambdaQuery().eq(Task::getTaskId,task.getTaskFatherId()));
|
||||
}
|
||||
return false;
|
||||
}catch(Exception e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue