Add GetUserInfo
This commit is contained in:
@@ -6,7 +6,7 @@ import top.fatweb.api.vo.PageVo
|
||||
import top.fatweb.api.vo.system.SysLogGetVo
|
||||
|
||||
object SysLogConverter {
|
||||
fun sysLogPageToSysLogPageVo(syslogPage: IPage<SysLog>): PageVo<SysLogGetVo> = PageVo<SysLogGetVo>(
|
||||
fun sysLogPageToSysLogPageVo(syslogPage: IPage<SysLog>): PageVo<SysLogGetVo> = PageVo(
|
||||
syslogPage.total,
|
||||
syslogPage.pages,
|
||||
syslogPage.size,
|
||||
|
||||
@@ -2,6 +2,10 @@ package top.fatweb.api.converter
|
||||
|
||||
import top.fatweb.api.entity.permission.User
|
||||
import top.fatweb.api.param.authentication.LoginParam
|
||||
import top.fatweb.api.vo.authentication.ElementVo
|
||||
import top.fatweb.api.vo.authentication.MenuVo
|
||||
import top.fatweb.api.vo.authentication.OperationVo
|
||||
import top.fatweb.api.vo.authentication.UserInfoVo
|
||||
|
||||
object UserConverter {
|
||||
fun loginParamToUser(loginParam: LoginParam): User {
|
||||
@@ -12,4 +16,45 @@ object UserConverter {
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
fun userToUserInfoVo(user: User) = UserInfoVo(
|
||||
id = user.id,
|
||||
username = user.username,
|
||||
locking = user.locking?.let { it == 1 },
|
||||
expiration = user.expiration,
|
||||
credentialsExpiration = user.credentialsExpiration,
|
||||
enable = user.enable?.let { it == 1 },
|
||||
lastLoginTime = user.lastLoginTime,
|
||||
lastLoginIp = user.lastLoginIp,
|
||||
createTime = user.createTime,
|
||||
updateTime = user.updateTime,
|
||||
menus = user.menus?.map {
|
||||
MenuVo(
|
||||
id = it.id,
|
||||
name = it.name,
|
||||
url = it.url,
|
||||
powerId = it.powerId,
|
||||
parentId = it.parentId
|
||||
)
|
||||
},
|
||||
elements = user.elements?.map {
|
||||
ElementVo(
|
||||
id = it.id,
|
||||
name = it.name,
|
||||
powerId = it.powerId,
|
||||
parentId = it.parentId,
|
||||
menuId = it.menuId
|
||||
)
|
||||
},
|
||||
operations = user.operations?.map {
|
||||
OperationVo(
|
||||
id = it.id,
|
||||
name = it.name,
|
||||
code = it.code,
|
||||
powerId = it.powerId,
|
||||
parentId = it.parentId,
|
||||
elementId = it.elementId
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user