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): UserView?

根据 ID 查询用户

Link copied to clipboard
@GetMapping(value = ["/permissions"])
fun getCurrentPermissionCodes(@AuthenticationPrincipal user: UserInfo): List<String>

获取当前用户权限编码列表

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

获取当前用户信息

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

分页条件查询用户

Link copied to clipboard
@GetMapping(value = ["/list"])
fun listUsers(@ModelAttribute specification: UserSpecification): List<UserView>

条件查询用户列表

Link copied to clipboard
@PostMapping
fun save(@RequestBody @Valid input: SaveUserInput): UserView

新增用户

Link copied to clipboard
@PutMapping
fun update(@RequestBody @Valid input: UpdateUserInput): UserView

更新用户