初步实现了批量删除用户的接口

master
GPU is all you need 4 years ago
parent f119ca979e
commit 6b3e831d44
  1. 20
      awardBE/src/main/java/edu/ncst/award/controller/UserController.java

@ -15,13 +15,13 @@ import edu.ncst.award.utils.StringUtils;
import edu.ncst.award.vo.ResultVO;
import edu.ncst.award.vo.param.CurrentUserDTO;
import edu.ncst.award.vo.param.query.PageQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -34,8 +34,8 @@ import java.util.stream.Collectors;
* 用户 控制器
*/
@Slf4j
@Api(tags = "用户")
@RestController
@Controller
@RequiredArgsConstructor
@RequestMapping("/api/user")
public class UserController extends BaseController {
@ -111,11 +111,25 @@ public class UserController extends BaseController {
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*/
@ApiOperation("删除用户")
@DeleteMapping("/{userIds}")
public ResultVO<Void> remove(@ApiParam("角色ID串") @PathVariable Long[] userIds, @RequestBody User user) {
// 前端回传来一个deleteUserId我用User对象接收
// if (ArrayUtil.contains(userIds, getUserId())) {
// this getUserId will return current User id
// return ResultUtils.error("当前用户不能删除");
// }
return toAjax(userService.deleteUserByIds(userIds));
}
@ApiOperation("获取当前用户信息")
@GetMapping("/current")
public ResponseEntity<?> getCurrentUser() {
CurrentUserDTO currentUserDTO = userService.getCurrentUser();
return ResponseUtils.success(currentUserDTO);
}

Loading…
Cancel
Save