更改了ProjectGroup相关的东西,适配了新的数据库结构变动
parent
16f55b05bd
commit
83d95b1227
|
@ -14,4 +14,5 @@ public class ProjectGroup {
|
||||||
Integer staffId;
|
Integer staffId;
|
||||||
Integer projectId;
|
Integer projectId;
|
||||||
String projectStaffPosition;
|
String projectStaffPosition;
|
||||||
|
Integer projectAccessLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface IProjectGroupService extends IService<ProjectGroup> {
|
public interface IProjectGroupService extends IService<ProjectGroup> {
|
||||||
Boolean addCreator(Integer projectId, Integer staffId);
|
Boolean addCreator(Integer projectId, Integer staffId);
|
||||||
Integer getUserLevelInGroup(String token,Integer projectId);
|
|
||||||
|
/**
|
||||||
|
* @return 如果不存在就返回0,否则返回AccessLevel
|
||||||
|
*/
|
||||||
|
Integer getUserLevelInGroup(String token, Integer projectId);
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
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.entity.Staff;
|
|
||||||
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;
|
||||||
|
@ -9,8 +8,6 @@ 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.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 张韬
|
* @author 张韬
|
||||||
* created at 2022/6/30 21:38
|
* created at 2022/6/30 21:38
|
||||||
|
@ -24,25 +21,23 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
|
||||||
ProjectGroup projectGroup = new ProjectGroup();
|
ProjectGroup projectGroup = new ProjectGroup();
|
||||||
projectGroup.setProjectId(projectId);
|
projectGroup.setProjectId(projectId);
|
||||||
projectGroup.setStaffId(staffId);
|
projectGroup.setStaffId(staffId);
|
||||||
projectGroup.setProjectStaffPosition("负责人");
|
projectGroup.setProjectStaffPosition("项目经理");
|
||||||
|
projectGroup.setProjectAccessLevel(1);
|
||||||
return baseMapper.insert(projectGroup) == 1;
|
return baseMapper.insert(projectGroup) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getUserLevelInGroup(String token,Integer projectId){
|
public Integer getUserLevelInGroup(String token, Integer projectId) {
|
||||||
try{
|
try {
|
||||||
Integer staffId= TokenUtils.getStaffId(token);
|
Integer staffId = TokenUtils.getStaffId(token);
|
||||||
ProjectGroup projectGroup=baseMapper.selectOne(Wrappers.<ProjectGroup>lambdaQuery().eq(ProjectGroup::getStaffId, staffId).eq(ProjectGroup::getProjectId, projectId));
|
ProjectGroup projectGroup = baseMapper.selectOne(Wrappers.<ProjectGroup>lambdaQuery()
|
||||||
if(projectGroup == null)
|
.eq(ProjectGroup::getStaffId, staffId)
|
||||||
|
.eq(ProjectGroup::getProjectId, projectId)
|
||||||
|
);
|
||||||
|
if (projectGroup == null)
|
||||||
return 0;
|
return 0;
|
||||||
else if(projectGroup.getProjectStaffPosition().equals("负责人"))
|
return projectGroup.getProjectAccessLevel();
|
||||||
return 3;
|
} catch (Exception e) {
|
||||||
else if(projectGroup.getProjectStaffPosition().length()>0)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}catch(Exception e){//需要调整
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue