修复了merge导致的代码丢失,删除了无用的import

master
ArgonarioD 2022-07-06 20:03:24 +08:00
parent f0ca1ce6d9
commit 7f8b244435
4 changed files with 36 additions and 9 deletions

View File

@ -1,12 +1,19 @@
package cn.edu.hfut.rmdjzz.projectmanagement.controller;
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
import cn.edu.hfut.rmdjzz.projectmanagement.exception.UnauthorizedException;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* @author
@ -25,4 +32,33 @@ public class ProjectGroupController {
List<Integer> res = projectGroupService.findAllProjectNumber(token, projectId);
return ResponseList.ofSuccess("查询成功", res);
}
@SneakyThrows
@GetMapping("/{staffId}")
public ResponseMap getDesignatedStaffPosition(
@RequestHeader("Token") String token,
@PathVariable Integer staffId,
@PathVariable Integer projectId
) {
if (!Objects.equals(TokenUtils.getStaffId(token), staffId)) {
throw new BadRequestException("用户访问错误");
}
if (projectGroupService.getUserLevelInGroup(token, projectId) == 0) {
throw new UnauthorizedException("无该项目访问权限");
}
return ResponseMap.ofSuccess("查询成功", projectGroupService.getOne(
Wrappers.<ProjectGroup>lambdaQuery()
.eq(ProjectGroup::getStaffId, staffId)
.eq(ProjectGroup::getProjectId, projectId)
));
}
@PutMapping("/{staffId}")
public ResponseMap updateDesignatedStaffPosition(
@RequestHeader("Token") String token,
@PathVariable Integer staffId,
@PathVariable Integer projectId
) {
return ResponseMap.ofSuccess("更新成功");
}
}

View File

@ -1,8 +1,6 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -14,7 +12,6 @@ import java.time.LocalDate;
*/
@Data
@AllArgsConstructor
@TableName(autoResultMap = true)
public class ResultProject {
@TableId
Integer projectId;

View File

@ -1,12 +1,8 @@
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
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 java.util.List;
/**
* @author
* created at 2022/6/30 21:34

View File

@ -7,8 +7,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
/**