UserController

@RequestMapping(value = ["/user"])
@RestController
class UserController(userService: UserService)

用户控制器

Author

lishangbu

Since

2025/8/30

Constructors

Link copied to clipboard
constructor(userService: UserService)

Functions

Link copied to clipboard
@DeleteMapping(value = ["/{id:\d+}"])
fun deleteById(@PathVariable id: Long)

根据 ID 删除用户

Link copied to clipboard
@GetMapping(value = ["/{id:\d+}"])
fun getById(@PathVariable id: Long): User?

根据 ID 查询用户

Link copied to clipboard
@GetMapping(value = ["/info"])
fun getUserInfo(@AuthenticationPrincipal user: UserInfo): UserWithRoles?

获取当前用户信息

Link copied to clipboard
@GetMapping(value = ["/page"])
fun getUserPage(pageable: Pageable, user: User): Page<User>

分页条件查询用户

Link copied to clipboard
@GetMapping(value = ["/list"])
fun listUsers(user: User): List<User>

条件查询用户列表

Link copied to clipboard
@PostMapping
fun save(@RequestBody user: User): User

新增用户

Link copied to clipboard
@PutMapping
fun update(@RequestBody user: User): User

更新用户