|
|
|
@ -15,13 +15,13 @@ import edu.ncst.award.utils.StringUtils; |
|
|
|
import edu.ncst.award.vo.ResultVO; |
|
|
|
import edu.ncst.award.vo.ResultVO; |
|
|
|
import edu.ncst.award.vo.param.CurrentUserDTO; |
|
|
|
import edu.ncst.award.vo.param.CurrentUserDTO; |
|
|
|
import edu.ncst.award.vo.param.query.PageQuery; |
|
|
|
import edu.ncst.award.vo.param.query.PageQuery; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.security.crypto.bcrypt.BCrypt; |
|
|
|
import org.springframework.security.crypto.bcrypt.BCrypt; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
@ -34,8 +34,8 @@ import java.util.stream.Collectors; |
|
|
|
* 用户 控制器 |
|
|
|
* 用户 控制器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
|
|
|
|
@Api(tags = "用户") |
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@Controller |
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequestMapping("/api/user") |
|
|
|
@RequestMapping("/api/user") |
|
|
|
public class UserController extends BaseController { |
|
|
|
public class UserController extends BaseController { |
|
|
|
@ -111,11 +111,25 @@ public class UserController extends BaseController { |
|
|
|
return toAjax(userService.updateUser(user)); |
|
|
|
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("获取当前用户信息") |
|
|
|
@ApiOperation("获取当前用户信息") |
|
|
|
@GetMapping("/current") |
|
|
|
@GetMapping("/current") |
|
|
|
public ResponseEntity<?> getCurrentUser() { |
|
|
|
public ResponseEntity<?> getCurrentUser() { |
|
|
|
CurrentUserDTO currentUserDTO = userService.getCurrentUser(); |
|
|
|
CurrentUserDTO currentUserDTO = userService.getCurrentUser(); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseUtils.success(currentUserDTO); |
|
|
|
return ResponseUtils.success(currentUserDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|