Add kdoc
This commit is contained in:
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.base.FuncVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object FuncConverter {
|
||||
/**
|
||||
* Convert Func object into FuncVo object
|
||||
*
|
||||
* @param func Func object
|
||||
* @return FuncVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Func
|
||||
* @see FuncVo
|
||||
*/
|
||||
fun funcToFuncVo(func: Func) = FuncVo(
|
||||
id = func.id,
|
||||
name = func.name,
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage
|
||||
import top.fatweb.api.entity.permission.Group
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
import top.fatweb.api.param.permission.group.GroupAddParam
|
||||
import top.fatweb.api.param.permission.group.GroupChangeStatusParam
|
||||
import top.fatweb.api.param.permission.group.GroupUpdateStatusParam
|
||||
import top.fatweb.api.param.permission.group.GroupUpdateParam
|
||||
import top.fatweb.api.vo.PageVo
|
||||
import top.fatweb.api.vo.permission.base.GroupVo
|
||||
@@ -17,6 +17,16 @@ import top.fatweb.api.vo.permission.GroupWithRoleVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object GroupConverter {
|
||||
/**
|
||||
* Convert Group object into GroupVo object
|
||||
*
|
||||
* @param group Group object
|
||||
* @return GroupVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Group
|
||||
* @see GroupVo
|
||||
*/
|
||||
fun groupToGroupVo(group: Group) = GroupVo(
|
||||
id = group.id,
|
||||
name = group.name,
|
||||
@@ -25,6 +35,16 @@ object GroupConverter {
|
||||
updateTime = group.updateTime
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert Group object into GroupWithRoleVo object
|
||||
*
|
||||
* @param group Group object
|
||||
* @return GroupWithRoleVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Group
|
||||
* @see GroupWithRoleVo
|
||||
*/
|
||||
fun groupToGroupWithRoleVo(group: Group) = GroupWithRoleVo(
|
||||
id = group.id,
|
||||
name = group.name,
|
||||
@@ -34,7 +54,19 @@ object GroupConverter {
|
||||
roles = group.roles?.map { RoleConverter.roleToRoleVo(it) }
|
||||
)
|
||||
|
||||
fun groupPageToGroupWithRolePageVo(groupPage: IPage<Group>): PageVo<GroupWithRoleVo> = PageVo(
|
||||
/**
|
||||
* Convert IPage<Group> object into PageVo<GroupWithRoleVo> object
|
||||
*
|
||||
* @param groupPage IPage<Group> object
|
||||
* @return PageVo<GroupWithRoleVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IPage
|
||||
* @see Group
|
||||
* @see PageVo
|
||||
* @see GroupWithRoleVo
|
||||
*/
|
||||
fun groupPageToGroupWithRolePageVo(groupPage: IPage<Group>) = PageVo(
|
||||
total = groupPage.total,
|
||||
pages = groupPage.pages,
|
||||
size = groupPage.size,
|
||||
@@ -44,21 +76,51 @@ object GroupConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert GroupAddParam object into Group object
|
||||
*
|
||||
* @param groupAddParam GroupAddParam object
|
||||
* @return Group object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see GroupAddParam
|
||||
* @see Group
|
||||
*/
|
||||
fun groupAddParamToGroup(groupAddParam: GroupAddParam) = Group().apply {
|
||||
name = groupAddParam.name
|
||||
enable = if (groupAddParam.enable) 1 else 0
|
||||
roles = groupAddParam.roleIds?.map { Role().apply { id = it } }
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert GroupUpdateParam object into Group object
|
||||
*
|
||||
* @param groupUpdateParam GroupUpdateParam object
|
||||
* @return Group object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see GroupUpdateParam
|
||||
* @see Group
|
||||
*/
|
||||
fun groupUpdateParamToGroup(groupUpdateParam: GroupUpdateParam) = Group().apply {
|
||||
id = groupUpdateParam.id
|
||||
name = groupUpdateParam.name
|
||||
enable = if (groupUpdateParam.enable == true) 1 else 0
|
||||
enable = if (groupUpdateParam.enable) 1 else 0
|
||||
roles = groupUpdateParam.roleIds?.map { Role().apply { id = it } }
|
||||
}
|
||||
|
||||
fun groupChangeStatusParamToGroup(groupChangeStatusParam: GroupChangeStatusParam) = Group().apply {
|
||||
id = groupChangeStatusParam.id
|
||||
enable = if (groupChangeStatusParam.enable) 1 else 0
|
||||
/**
|
||||
* Convert GroupUpdateStatusParam object into Group object
|
||||
*
|
||||
* @param groupUpdateStatusParam GroupUpdateStatusParam object
|
||||
* @return Group object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see GroupUpdateStatusParam
|
||||
* @see Group
|
||||
*/
|
||||
fun groupUpdateStatusParamToGroup(groupUpdateStatusParam: GroupUpdateStatusParam) = Group().apply {
|
||||
id = groupUpdateStatusParam.id
|
||||
enable = if (groupUpdateStatusParam.enable) 1 else 0
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.base.MenuVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object MenuConverter {
|
||||
/**
|
||||
* Convert Menu object into MenuVo object
|
||||
*
|
||||
* @param menu Menu object
|
||||
* @return MenuVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Menu
|
||||
* @see MenuVo
|
||||
*/
|
||||
fun menuToMenuVo(menu: Menu) = MenuVo(
|
||||
id = menu.id,
|
||||
name = menu.name,
|
||||
|
||||
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.base.ModuleVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object ModuleConverter {
|
||||
/**
|
||||
* Convert Module object into ModuleVo object
|
||||
*
|
||||
* @param module Module object
|
||||
* @return ModuleVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Module
|
||||
* @see ModuleVo
|
||||
*/
|
||||
fun moduleToModuleVo(module: Module) = ModuleVo(
|
||||
id = module.id,
|
||||
name = module.name
|
||||
|
||||
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.base.OperationVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object OperationConverter {
|
||||
/**
|
||||
* Convert Operation object into OperationVo object
|
||||
*
|
||||
* @param operation Operation object
|
||||
* @return OperationVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Operation
|
||||
* @see OperationVo
|
||||
*/
|
||||
fun operationToOperationVo(operation: Operation) = OperationVo(
|
||||
id = operation.id,
|
||||
name = operation.name,
|
||||
|
||||
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.PowerSetVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object PowerConverter {
|
||||
/**
|
||||
* Convert PowerSet object into PowerSetVo object
|
||||
*
|
||||
* @param powerSet PowerSet object
|
||||
* @return PowerSetVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see PowerSet
|
||||
* @see PowerSetVo
|
||||
*/
|
||||
fun powerSetToPowerSetVo(powerSet: PowerSet) = PowerSetVo(
|
||||
moduleList = powerSet.moduleList?.map { ModuleConverter.moduleToModuleVo(it) },
|
||||
menuList = powerSet.menuList?.map { MenuConverter.menuToMenuVo(it) },
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage
|
||||
import top.fatweb.api.entity.permission.Power
|
||||
import top.fatweb.api.entity.permission.Role
|
||||
import top.fatweb.api.param.permission.role.RoleAddParam
|
||||
import top.fatweb.api.param.permission.role.RoleChangeStatusParam
|
||||
import top.fatweb.api.param.permission.role.RoleUpdateStatusParam
|
||||
import top.fatweb.api.param.permission.role.RoleUpdateParam
|
||||
import top.fatweb.api.vo.PageVo
|
||||
import top.fatweb.api.vo.permission.base.RoleVo
|
||||
@@ -17,6 +17,16 @@ import top.fatweb.api.vo.permission.RoleWithPowerVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object RoleConverter {
|
||||
/**
|
||||
* Convert Role object into RoleVo object
|
||||
*
|
||||
* @param role Role object
|
||||
* @return RoleVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Role
|
||||
* @see RoleVo
|
||||
*/
|
||||
fun roleToRoleVo(role: Role) = RoleVo(
|
||||
id = role.id,
|
||||
name = role.name,
|
||||
@@ -25,6 +35,16 @@ object RoleConverter {
|
||||
updateTime = role.updateTime
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert Role object into RoleWithPowerVo object
|
||||
*
|
||||
* @param role Role object
|
||||
* @return RoleWithPowerVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Role
|
||||
* @see RoleWithPowerVo
|
||||
*/
|
||||
fun roleToRoleWithPowerVo(role: Role) = RoleWithPowerVo(
|
||||
id = role.id,
|
||||
name = role.name,
|
||||
@@ -37,6 +57,18 @@ object RoleConverter {
|
||||
operations = role.operations?.map { OperationConverter.operationToOperationVo(it) }
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert IPage<Role> object into PageVo object
|
||||
*
|
||||
* @param rolePage IPage<Role> object
|
||||
* @return PageVo<RoleWithPowerVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IPage
|
||||
* @see Role
|
||||
* @see PageVo
|
||||
* @see RoleWithPowerVo
|
||||
*/
|
||||
fun rolePageToRoleWithPowerPageVo(rolePage: IPage<Role>) = PageVo(
|
||||
total = rolePage.total,
|
||||
pages = rolePage.pages,
|
||||
@@ -47,21 +79,51 @@ object RoleConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert RoleAddParam object into Role object
|
||||
*
|
||||
* @param roleAddParam RoleAddParam object
|
||||
* @return Role object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RoleAddParam
|
||||
* @see Role
|
||||
*/
|
||||
fun roleAddParamToRole(roleAddParam: RoleAddParam) = Role().apply {
|
||||
name = roleAddParam.name
|
||||
enable = if (roleAddParam.enable == true) 1 else 0
|
||||
enable = if (roleAddParam.enable) 1 else 0
|
||||
powers = roleAddParam.powerIds?.map { Power().apply { id = it } }
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert RoleUpdateParam into Role object
|
||||
*
|
||||
* @param roleUpdateParam RoleUpdateParam object
|
||||
* @return Role object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RoleUpdateParam
|
||||
* @see Role
|
||||
*/
|
||||
fun roleUpdateParamToRole(roleUpdateParam: RoleUpdateParam) = Role().apply {
|
||||
id = roleUpdateParam.id
|
||||
name = roleUpdateParam.name
|
||||
enable = if (roleUpdateParam.enable == true) 1 else 0
|
||||
enable = if (roleUpdateParam.enable) 1 else 0
|
||||
powers = roleUpdateParam.powerIds?.map { Power().apply { id = it } }
|
||||
}
|
||||
|
||||
fun roleChangeStatusParamToRole(roleChangeStatusParam: RoleChangeStatusParam) = Role().apply {
|
||||
id = roleChangeStatusParam.id
|
||||
enable = if (roleChangeStatusParam.enable) 1 else 0
|
||||
/**
|
||||
* Convert RoleUpdateStatusParam object into Role object
|
||||
*
|
||||
* @param roleUpdateStatusParam RoleUpdateStatusParam object
|
||||
* @return Role object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RoleUpdateStatusParam
|
||||
* @see Role
|
||||
*/
|
||||
fun roleUpdateStatusParamToRole(roleUpdateStatusParam: RoleUpdateStatusParam) = Role().apply {
|
||||
id = roleUpdateStatusParam.id
|
||||
enable = if (roleUpdateStatusParam.enable) 1 else 0
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,31 @@ import top.fatweb.avatargenerator.GitHubAvatar
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object UserConverter {
|
||||
|
||||
/**
|
||||
* Convert LoginParam object into User object
|
||||
*
|
||||
* @param loginParam LoginParam object
|
||||
* @return User object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LoginParam
|
||||
* @see User
|
||||
*/
|
||||
fun loginParamToUser(loginParam: LoginParam) = User().apply {
|
||||
username = loginParam.username
|
||||
password = loginParam.password
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert User object into UserWithPowerInfoVo object
|
||||
*
|
||||
* @param user User object
|
||||
* @return UserWithPowerInfoVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see User
|
||||
* @see UserWithPowerInfoVo
|
||||
*/
|
||||
fun userToUserWithPowerInfoVo(user: User) = UserWithPowerInfoVo(
|
||||
id = user.id,
|
||||
username = user.username,
|
||||
@@ -58,6 +77,16 @@ object UserConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert User object into UserWithRoleInfoVo object
|
||||
*
|
||||
* @param user User object
|
||||
* @return UserWithRoleInfoVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see User
|
||||
* @see UserWithRoleInfoVo
|
||||
*/
|
||||
fun userToUserWithRoleInfoVo(user: User) = UserWithRoleInfoVo(
|
||||
id = user.id,
|
||||
username = user.username,
|
||||
@@ -82,6 +111,16 @@ object UserConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert User object into UserWithInfoVo object
|
||||
*
|
||||
* @param user User object
|
||||
* @return UserWithInfoVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see User
|
||||
* @see UserWithInfoVo
|
||||
*/
|
||||
fun userToUserWithInfoVo(user: User) = UserWithInfoVo(
|
||||
id = user.id,
|
||||
username = user.username,
|
||||
@@ -100,6 +139,16 @@ object UserConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert User object into UserWithPasswordRoleInfoVo object
|
||||
*
|
||||
* @param user User object
|
||||
* @return UserWithPasswordRoleInfoVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see User
|
||||
* @see UserWithPasswordRoleInfoVo
|
||||
*/
|
||||
fun userToUserWithPasswordRoleInfoVo(user: User) = UserWithPasswordRoleInfoVo(
|
||||
id = user.id,
|
||||
username = user.username,
|
||||
@@ -125,6 +174,16 @@ object UserConverter {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert UserAddParam object into User object
|
||||
*
|
||||
* @param userAddParam UserAddParam object
|
||||
* @return User object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see UserAddParam
|
||||
* @see User
|
||||
*/
|
||||
fun userAddParamToUser(userAddParam: UserAddParam) = User().apply {
|
||||
username = userAddParam.username
|
||||
password = userAddParam.password
|
||||
@@ -142,6 +201,16 @@ object UserConverter {
|
||||
groups = userAddParam.groupIds?.map { Group().apply { id = it } }
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert UserUpdateParam object into User object
|
||||
*
|
||||
* @param userUpdateParam UserUpdateParam object
|
||||
* @return User object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see UserUpdateParam
|
||||
* @see User
|
||||
*/
|
||||
fun userUpdateParamToUser(userUpdateParam: UserUpdateParam) = User().apply {
|
||||
id = userUpdateParam.id
|
||||
username = userUpdateParam.username
|
||||
@@ -158,6 +227,18 @@ object UserConverter {
|
||||
groups = if (userUpdateParam.id != 0L) userUpdateParam.groupIds?.map { Group().apply { id = it } } else null
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert IPage<User> object into PageVo<UserWithRoleInfoVo> object
|
||||
*
|
||||
* @param userPage IPage<User> object
|
||||
* @return PageVo<UserWithRoleInfoVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IPage
|
||||
* @see User
|
||||
* @see PageVo
|
||||
* @see UserWithRoleInfoVo
|
||||
*/
|
||||
fun userPageToUserWithRoleInfoPageVo(userPage: IPage<User>) = PageVo(
|
||||
total = userPage.total,
|
||||
pages = userPage.pages,
|
||||
|
||||
@@ -10,6 +10,16 @@ import top.fatweb.api.vo.permission.base.UserInfoVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object UserInfoConverter {
|
||||
/**
|
||||
* Convert UserInfo object into UserInfoVo object
|
||||
*
|
||||
* @param userInfo UserInfo object
|
||||
* @return UserInfoVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see UserInfo
|
||||
* @see UserInfoVo
|
||||
*/
|
||||
fun userInfoToUserInfoVo(userInfo: UserInfo) = UserInfoVo(
|
||||
id = userInfo.id,
|
||||
userId = userInfo.userId,
|
||||
|
||||
@@ -12,7 +12,19 @@ import top.fatweb.api.vo.system.SysLogVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object SysLogConverter {
|
||||
fun sysLogPageToSysLogPageVo(syslogPage: IPage<SysLog>): PageVo<SysLogVo> = PageVo(
|
||||
/**
|
||||
* Convert IPage<SysLog> object into PageVo<SysLogVo> object
|
||||
*
|
||||
* @param syslogPage IPage<Syslog> object
|
||||
* @return PageVo<SysLogVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IPage
|
||||
* @see SysLog
|
||||
* @see PageVo
|
||||
* @see SysLogVo
|
||||
*/
|
||||
fun sysLogPageToSysLogPageVo(syslogPage: IPage<SysLog>) = PageVo(
|
||||
syslogPage.total,
|
||||
syslogPage.pages,
|
||||
syslogPage.size,
|
||||
|
||||
Reference in New Issue
Block a user