Add get user list controller

This commit is contained in:
2023-11-01 18:26:49 +08:00
parent a94bf94bc7
commit e5c71c8a51
18 changed files with 237 additions and 23 deletions

View File

@@ -6,7 +6,8 @@ import org.springframework.web.bind.annotation.RestController
import top.fatweb.api.converter.permission.UserConverter
import top.fatweb.api.entity.common.ResponseResult
import top.fatweb.api.service.permission.IUserService
import top.fatweb.api.vo.permission.UserWithInfoVo
import top.fatweb.api.vo.permission.UserWithPowerInfoVo
import top.fatweb.api.vo.permission.UserWithRoleInfoVo
/**
* <p>
@@ -22,10 +23,16 @@ class UserController(
private val userService: IUserService
) {
@GetMapping("info")
fun getInfo(): ResponseResult<UserWithInfoVo> {
fun getInfo(): ResponseResult<UserWithPowerInfoVo> {
userService.getInfo()?.let {
return ResponseResult.databaseSuccess(data = UserConverter.userToUserInfoVo(it))
return ResponseResult.databaseSuccess(data = UserConverter.userToUserWithPowerInfoVo(it))
} ?: let { return ResponseResult.databaseFail() }
}
@GetMapping
fun get(): ResponseResult<List<UserWithRoleInfoVo>> {
return ResponseResult.databaseSuccess(
data = userService.getList().map { UserConverter.userToUserWithRoleInfoVo(it) })
}
}