修复了compareProjectAccessLevel的错误使用

master
ArgonarioD 2022-07-12 14:04:22 +08:00
parent 71cb31427f
commit ff47276365
4 changed files with 5 additions and 5 deletions

View File

@ -94,7 +94,7 @@ public class ProjectGroupController {
@PathVariable Integer projectId, @PathVariable Integer projectId,
@PathVariable Integer staffId @PathVariable Integer staffId
) { ) {
if (projectGroupService.compareProjectAccessLevel(projectId, token, staffId) <= 0) { if (projectGroupService.compareProjectAccessLevel(projectId, token, staffId) >= 0) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
} }
if (projectGroupService.remove(Wrappers.<ProjectGroup>lambdaQuery() if (projectGroupService.remove(Wrappers.<ProjectGroup>lambdaQuery()

View File

@ -45,7 +45,7 @@ public interface IProjectGroupService extends IService<ProjectGroup> {
* <p> * <p>
* tokenid * tokenid
* <p> * <p>
* {@link Integer#compare(int, int)} * {@link Integer#compare(int, int)}使compareProjectAccessLevel(...)>()0<token
*/ */
Integer compareProjectAccessLevel(Integer projectId, String token, Integer targetId); Integer compareProjectAccessLevel(Integer projectId, String token, Integer targetId);

View File

@ -71,7 +71,7 @@ public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Ann
if (!Objects.equals(projectId, rawAnnouncement.getProjectId())) { if (!Objects.equals(projectId, rawAnnouncement.getProjectId())) {
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS); throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
} }
if (projectGroupService.compareProjectAccessLevel(projectId, token, rawAnnouncement.getAnnouncementPublisherId()) < 0) { if (projectGroupService.compareProjectAccessLevel(projectId, token, rawAnnouncement.getAnnouncementPublisherId()) > 0) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
} }
return removeById(announcementId); return removeById(announcementId);

View File

@ -443,7 +443,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|| projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(transferredStaffId, projectId) == 0) { || projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(transferredStaffId, projectId) == 0) {
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
} }
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) < 0) { if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
} }
@ -498,7 +498,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|| projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(targetStaffId, projectId) == 0) { || projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(targetStaffId, projectId) == 0) {
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
} }
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) < 0) { if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
} }
Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery().eq(Task::getTaskHolderId, transferredStaffId)); Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery().eq(Task::getTaskHolderId, transferredStaffId));