From 00964a15f3ff58b651cb9cb24fd6210f1e0b9aa5 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 4 Dec 2023 18:05:57 +0800 Subject: [PATCH] Add kdoc --- .../top/fatweb/api/FatWebApiApplication.kt | 7 + .../top/fatweb/api/config/InitConfig.kt | 3 + .../top/fatweb/api/config/SecurityConfig.kt | 3 + .../top/fatweb/api/config/SysLogConfig.kt | 1 + .../api/controller/api/v1/AvatarController.kt | 1 + .../permission/AuthenticationController.kt | 1 + .../controller/permission/GroupController.kt | 1 + .../controller/permission/PowerController.kt | 1 + .../controller/permission/RoleController.kt | 1 + .../controller/permission/UserController.kt | 1 + .../api/controller/system/MailController.kt | 12 ++ .../controller/system/SettingsController.kt | 20 ++ .../api/controller/system/SysLogController.kt | 1 + .../api/converter/system/SettingsConverter.kt | 26 +++ .../fatweb/api/entity/common/BusinessCode.kt | 27 +++ .../api/entity/common/ResponseResult.kt | 61 ++++++ .../top/fatweb/api/entity/permission/Func.kt | 22 +- .../top/fatweb/api/entity/permission/Group.kt | 48 ++++- .../fatweb/api/entity/permission/LoginUser.kt | 8 + .../top/fatweb/api/entity/permission/Menu.kt | 25 ++- .../fatweb/api/entity/permission/Module.kt | 12 +- .../fatweb/api/entity/permission/Operation.kt | 22 +- .../top/fatweb/api/entity/permission/Power.kt | 12 +- .../fatweb/api/entity/permission/PowerRole.kt | 29 ++- .../fatweb/api/entity/permission/PowerSet.kt | 28 +++ .../fatweb/api/entity/permission/PowerType.kt | 12 +- .../top/fatweb/api/entity/permission/Role.kt | 76 ++++++- .../fatweb/api/entity/permission/RoleGroup.kt | 29 ++- .../top/fatweb/api/entity/permission/User.kt | 133 ++++++++++-- .../fatweb/api/entity/permission/UserGroup.kt | 29 ++- .../fatweb/api/entity/permission/UserInfo.kt | 52 ++++- .../fatweb/api/entity/permission/UserRole.kt | 29 ++- .../top/fatweb/api/entity/system/SysLog.kt | 86 ++++++-- .../api/exception/NoRecordFoundException.kt | 1 + .../api/exception/TokenHasExpiredException.kt | 1 + .../top/fatweb/api/filter/ExceptionFilter.kt | 1 + .../filter/JwtAuthenticationTokenFilter.kt | 4 +- .../api/handler/DataMetaObjectHandler.kt | 1 + .../fatweb/api/handler/ExceptionHandler.kt | 10 + .../api/handler/JwtAccessDeniedHandler.kt | 1 + .../JwtAuthenticationEntryPointHandler.kt | 1 + .../api/interceptor/SysLogInterceptor.kt | 2 + .../api/mapper/permission/FuncMapper.kt | 2 + .../api/mapper/permission/GroupMapper.kt | 31 +++ .../api/mapper/permission/MenuMapper.kt | 2 + .../api/mapper/permission/ModuleMapper.kt | 2 + .../api/mapper/permission/OperationMapper.kt | 2 + .../api/mapper/permission/PowerMapper.kt | 2 + .../api/mapper/permission/PowerRoleMapper.kt | 2 + .../api/mapper/permission/RoleGroupMapper.kt | 2 + .../api/mapper/permission/RoleMapper.kt | 31 +++ .../api/mapper/permission/UserGroupMapper.kt | 2 + .../api/mapper/permission/UserInfoMapper.kt | 2 + .../api/mapper/permission/UserMapper.kt | 67 ++++++- .../api/mapper/permission/UserRoleMapper.kt | 2 + .../fatweb/api/mapper/system/SysLogMapper.kt | 19 ++ .../top/fatweb/api/param/PageSortParam.kt | 26 ++- .../param/api/v1/avatar/AvatarBaseParam.kt | 43 +++- .../api/v1/avatar/AvatarEightBitParam.kt | 8 - .../param/api/v1/avatar/AvatarGitHubParam.kt | 18 ++ .../fatweb/api/param/permission/LoginParam.kt | 14 +- .../param/permission/group/GroupAddParam.kt | 20 +- .../permission/group/GroupDeleteParam.kt | 8 +- .../param/permission/group/GroupGetParam.kt | 15 +- .../permission/group/GroupUpdateParam.kt | 26 ++- .../group/GroupUpdateStatusParam.kt | 14 +- .../api/param/permission/role/RoleAddParam.kt | 20 +- .../param/permission/role/RoleDeleteParam.kt | 8 +- .../api/param/permission/role/RoleGetParam.kt | 15 +- .../param/permission/role/RoleUpdateParam.kt | 26 ++- .../permission/role/RoleUpdateStatusParam.kt | 14 +- .../api/param/permission/user/UserAddParam.kt | 74 +++++++ .../param/permission/user/UserDeleteParam.kt | 8 +- .../api/param/permission/user/UserGetParam.kt | 21 +- .../param/permission/user/UserUpdateParam.kt | 74 +++++++ .../user/UserUpdatePasswordParam.kt | 25 +++ .../api/param/system/MailSettingsParam.kt | 50 ++++- .../fatweb/api/param/system/SysLogGetParam.kt | 41 +++- .../fatweb/api/properties/AdminProperties.kt | 27 +++ .../api/properties/SecurityProperties.kt | 50 ++++- .../fatweb/api/properties/ServerProperties.kt | 12 ++ .../api/service/api/v1/IAvatarService.kt | 89 ++++++++- .../service/api/v1/impl/AvatarServiceImpl.kt | 7 + .../permission/IAuthenticationService.kt | 29 +++ .../api/service/permission/IFuncService.kt | 2 + .../api/service/permission/IGroupService.kt | 74 +++++++ .../api/service/permission/IMenuService.kt | 2 + .../api/service/permission/IModuleService.kt | 2 + .../service/permission/IOperationService.kt | 2 + .../service/permission/IPowerRoleService.kt | 2 + .../api/service/permission/IPowerService.kt | 10 + .../service/permission/IRoleGroupService.kt | 2 + .../api/service/permission/IRoleService.kt | 74 +++++++ .../service/permission/IUserGroupService.kt | 2 + .../service/permission/IUserInfoService.kt | 2 + .../service/permission/IUserRoleService.kt | 2 + .../api/service/permission/IUserService.kt | 112 ++++++++++- .../impl/AuthenticationServiceImpl.kt | 4 + .../permission/impl/FuncServiceImpl.kt | 4 + .../permission/impl/GroupServiceImpl.kt | 9 +- .../permission/impl/MenuServiceImpl.kt | 4 + .../permission/impl/ModuleServiceImpl.kt | 4 + .../permission/impl/OperationServiceImpl.kt | 4 + .../permission/impl/PowerRoleServiceImpl.kt | 4 + .../permission/impl/PowerServiceImpl.kt | 8 + .../permission/impl/RoleGroupServiceImpl.kt | 4 + .../permission/impl/RoleServiceImpl.kt | 11 +- .../permission/impl/UserDetailsServiceImpl.kt | 2 + .../permission/impl/UserGroupServiceImpl.kt | 4 + .../permission/impl/UserInfoServiceImpl.kt | 3 + .../permission/impl/UserRoleServiceImpl.kt | 3 + .../permission/impl/UserServiceImpl.kt | 19 +- .../api/service/system/ISettingsService.kt | 21 ++ .../api/service/system/ISysLogService.kt | 13 ++ .../system/impl/SettingsServiceImpl.kt | 7 + .../service/system/impl/SysLogServiceImpl.kt | 4 + .../top/fatweb/api/settings/MailSettings.kt | 40 ++++ .../fatweb/api/settings/SettingsOperator.kt | 58 +++++- .../top/fatweb/api/settings/SystemSettings.kt | 12 ++ .../kotlin/top/fatweb/api/util/ByteUtil.kt | 88 +++++++- .../kotlin/top/fatweb/api/util/JwtUtil.kt | 30 ++- .../kotlin/top/fatweb/api/util/NumberUtil.kt | 24 +++ .../kotlin/top/fatweb/api/util/PageUtil.kt | 12 ++ .../kotlin/top/fatweb/api/util/RedisUtil.kt | 189 +++++++++++------- .../kotlin/top/fatweb/api/util/StrUtil.kt | 33 +++ .../kotlin/top/fatweb/api/util/WebUtil.kt | 55 ++++- src/main/kotlin/top/fatweb/api/vo/PageVo.kt | 30 +++ .../api/vo/api/v1/avatar/AvatarBase64Vo.kt | 6 + .../api/vo/permission/GroupWithRoleVo.kt | 39 ++++ .../top/fatweb/api/vo/permission/LoginVo.kt | 19 ++ .../fatweb/api/vo/permission/PowerSetVo.kt | 28 +++ .../api/vo/permission/RoleWithPowerVo.kt | 60 ++++++ .../top/fatweb/api/vo/permission/TokenVo.kt | 6 + .../api/vo/permission/UserWithInfoVo.kt | 85 ++++++++ .../permission/UserWithPasswordRoleInfoVo.kt | 105 ++++++++++ .../api/vo/permission/UserWithPowerInfoVo.kt | 110 ++++++++++ .../api/vo/permission/UserWithRoleInfoVo.kt | 101 ++++++++++ .../fatweb/api/vo/permission/base/FuncVo.kt | 24 +++ .../fatweb/api/vo/permission/base/GroupVo.kt | 32 +++ .../fatweb/api/vo/permission/base/MenuVo.kt | 30 +++ .../fatweb/api/vo/permission/base/ModuleVo.kt | 12 ++ .../api/vo/permission/base/OperationVo.kt | 24 +++ .../fatweb/api/vo/permission/base/RoleVo.kt | 32 +++ .../api/vo/permission/base/UserInfoVo.kt | 44 ++++ .../top/fatweb/api/vo/system/SettingsVo.kt | 53 +++++ .../top/fatweb/api/vo/system/SysLogVo.kt | 99 +++++++++ 146 files changed, 3486 insertions(+), 205 deletions(-) create mode 100644 src/main/kotlin/top/fatweb/api/controller/system/MailController.kt delete mode 100644 src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarEightBitParam.kt diff --git a/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt b/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt index 5351409..75a4be8 100644 --- a/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt +++ b/src/main/kotlin/top/fatweb/api/FatWebApiApplication.kt @@ -17,6 +17,13 @@ import java.util.* @EnableTransactionManagement class FatWebApiApplication +/** + * Main function + * + * @param args + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun main(args: Array) { val logger = LoggerFactory.getLogger("main") diff --git a/src/main/kotlin/top/fatweb/api/config/InitConfig.kt b/src/main/kotlin/top/fatweb/api/config/InitConfig.kt index e5294ca..e221b98 100644 --- a/src/main/kotlin/top/fatweb/api/config/InitConfig.kt +++ b/src/main/kotlin/top/fatweb/api/config/InitConfig.kt @@ -20,6 +20,9 @@ import top.fatweb.avatargenerator.GitHubAvatar * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IUserService + * @see IUserInfoService + * @see PasswordEncoder */ @DependsOn("adminProperties") @Component diff --git a/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt b/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt index 912f17a..ab735fe 100644 --- a/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt +++ b/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt @@ -22,6 +22,9 @@ import top.fatweb.api.handler.JwtAuthenticationEntryPointHandler * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see JwtAuthenticationTokenFilter + * @see JwtAuthenticationEntryPointHandler + * @see JwtAccessDeniedHandler */ @Configuration @EnableMethodSecurity diff --git a/src/main/kotlin/top/fatweb/api/config/SysLogConfig.kt b/src/main/kotlin/top/fatweb/api/config/SysLogConfig.kt index 2d8ac34..f8a76e4 100644 --- a/src/main/kotlin/top/fatweb/api/config/SysLogConfig.kt +++ b/src/main/kotlin/top/fatweb/api/config/SysLogConfig.kt @@ -10,6 +10,7 @@ import top.fatweb.api.interceptor.SysLogInterceptor * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see SysLogInterceptor * @see WebMvcConfigurer */ @Configuration diff --git a/src/main/kotlin/top/fatweb/api/controller/api/v1/AvatarController.kt b/src/main/kotlin/top/fatweb/api/controller/api/v1/AvatarController.kt index 56a1ab4..eaf416f 100644 --- a/src/main/kotlin/top/fatweb/api/controller/api/v1/AvatarController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/api/v1/AvatarController.kt @@ -20,6 +20,7 @@ import top.fatweb.api.vo.api.v1.avatar.AvatarBase64Vo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IAvatarService */ @Tag(name = "随机头像", description = "随机头像相关接口") @RequestMapping("/api/{apiVersion}/avatar") diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt index e2cbd63..d12dda8 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt @@ -22,6 +22,7 @@ import top.fatweb.api.vo.permission.TokenVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IAuthenticationService */ @Tag(name = "身份认证", description = "身份认证相关接口") @RestController diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/GroupController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/GroupController.kt index 3e43ad0..f701a07 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/GroupController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/GroupController.kt @@ -18,6 +18,7 @@ import top.fatweb.api.vo.permission.base.GroupVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IGroupService */ @Tag(name = "用户组管理", description = "用户组管理相关接口") @RequestMapping("/system/group") diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/PowerController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/PowerController.kt index 6e56c6f..68ef379 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/PowerController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/PowerController.kt @@ -15,6 +15,7 @@ import top.fatweb.api.vo.permission.PowerSetVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IPowerService */ @Tag(name = "权限管理", description = "权限管理相关接口") @RequestMapping("/system/power") diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/RoleController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/RoleController.kt index e05f62b..b591c1d 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/RoleController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/RoleController.kt @@ -18,6 +18,7 @@ import top.fatweb.api.vo.permission.base.RoleVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IRoleService */ @Tag(name = "角色管理", description = "角色管理相关接口") @RequestMapping("/system/role") diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt index de91840..1505c13 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/UserController.kt @@ -20,6 +20,7 @@ import top.fatweb.api.vo.permission.UserWithRoleInfoVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IUserService */ @Tag(name = "用户管理", description = "用户管理相关接口") @RequestMapping("/system/user") diff --git a/src/main/kotlin/top/fatweb/api/controller/system/MailController.kt b/src/main/kotlin/top/fatweb/api/controller/system/MailController.kt new file mode 100644 index 0000000..01bc336 --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/controller/system/MailController.kt @@ -0,0 +1,12 @@ +package top.fatweb.api.controller.system + +import io.swagger.v3.oas.annotations.tags.Tag +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +@Tag(name = "邮件接口", description = "邮件发送接口") +@RequestMapping("/system/mail") +@RestController +class MailController { + +} \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt b/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt index e458c95..7a2684d 100644 --- a/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt @@ -13,6 +13,7 @@ import top.fatweb.api.vo.system.SettingsVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ISettingsService */ @Tag(name = "系统设置", description = "系统设置相关接口") @RequestMapping("/system/settings") @@ -20,10 +21,29 @@ import top.fatweb.api.vo.system.SettingsVo class SettingsController( private val settingsService: ISettingsService ) { + /** + * Get all settings + * + * @return Response object includes all settings + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseResult + * @see SettingsVo + */ @Operation(summary = "获取全部设置") @GetMapping fun get(): ResponseResult = ResponseResult.success(data = settingsService.get()) + /** + * Update mail settings + * + * @param mailSettingsParam Mail settings parameters + * @return Response object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MailSettingsParam + * @see ResponseResult + */ @Operation(summary = "更新邮件设置") @PutMapping("/mail") fun updateMail(@RequestBody mailSettingsParam: MailSettingsParam): ResponseResult { diff --git a/src/main/kotlin/top/fatweb/api/controller/system/SysLogController.kt b/src/main/kotlin/top/fatweb/api/controller/system/SysLogController.kt index 5217752..c038a6c 100644 --- a/src/main/kotlin/top/fatweb/api/controller/system/SysLogController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/system/SysLogController.kt @@ -20,6 +20,7 @@ import top.fatweb.api.vo.system.SysLogVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ISysLogService */ @Tag(name = "系统日志", description = "系统日志相关接口") @RequestMapping("/system/log") diff --git a/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt b/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt index 7055f64..673d882 100644 --- a/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt +++ b/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt @@ -4,7 +4,23 @@ import top.fatweb.api.settings.MailSettings import top.fatweb.api.settings.SystemSettings import top.fatweb.api.vo.system.SettingsVo +/** + * Settings converter + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ object SettingsConverter { + /** + * Convert MailSettings object into MailSettingsVo object + * + * @param mailSettings MailSettings object + * @return MailSettingsVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MailSettings + * @see SettingsVo.MailSettingsVo + */ private fun mailSettingsToMailSettingsVo(mailSettings: MailSettings) = SettingsVo.MailSettingsVo( host = mailSettings.host, port = mailSettings.port, @@ -13,6 +29,16 @@ object SettingsConverter { from = mailSettings.from ) + /** + * Convert SystemSettings object into SettingVo object + * + * @param systemSettings SystemSettings object + * @return SettingsVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see SystemSettings + * @see SettingsVo + */ fun systemSettingsToSettingsVo(systemSettings: SystemSettings) = SettingsVo( mail = systemSettings.mail?.let { mailSettingsToMailSettingsVo(it) } ) diff --git a/src/main/kotlin/top/fatweb/api/entity/common/BusinessCode.kt b/src/main/kotlin/top/fatweb/api/entity/common/BusinessCode.kt index af8db71..faff351 100644 --- a/src/main/kotlin/top/fatweb/api/entity/common/BusinessCode.kt +++ b/src/main/kotlin/top/fatweb/api/entity/common/BusinessCode.kt @@ -7,8 +7,35 @@ package top.fatweb.api.entity.common * @since 1.0.0 */ enum class BusinessCode(val code: Int) { + /** + * System + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ SYSTEM(100), + + /** + * Permission + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ PERMISSION(200), + + /** + * Database + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ DATABASE(300), + + /** + * Avatar API + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ API_AVATAR(501) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/entity/common/ResponseResult.kt b/src/main/kotlin/top/fatweb/api/entity/common/ResponseResult.kt index 494150f..c3e2a1a 100644 --- a/src/main/kotlin/top/fatweb/api/entity/common/ResponseResult.kt +++ b/src/main/kotlin/top/fatweb/api/entity/common/ResponseResult.kt @@ -19,22 +19,83 @@ class ResponseResult private constructor( @Schema(description = "数据") val data: T? ) : Serializable { companion object { + /** + * Build response result object + * + * @param code Response code + * @param success Is successful + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun build(code: Int, success: Boolean, msg: String, data: T?) = ResponseResult(code, success, msg, data) + /** + * Build response result object + * + * @param code Response code object + * @param success Is successful + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseCode + */ fun build(code: ResponseCode, success: Boolean, msg: String, data: T?) = build(code.code, success, msg, data) + /** + * Build successful response result object + * + * @param code Response code object + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseCode + */ fun success(code: ResponseCode = ResponseCode.SYSTEM_OK, msg: String = "success", data: T? = null) = build(code, true, msg, data) + /** + * Build failure response result object + * + * @param code Response code object + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseCode + */ fun fail(code: ResponseCode = ResponseCode.SYSTEM_ERROR, msg: String = "fail", data: T? = null) = build(code, false, msg, data) + /** + * Build database successful response result object + * + * @param code Response code object + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseCode + */ fun databaseSuccess( code: ResponseCode = ResponseCode.DATABASE_SELECT_SUCCESS, msg: String = "success", data: T? = null ) = build(code, true, msg, data) + /** + * Build database failure response result object + * + * @param code Response code object + * @param msg Response message + * @param data Response data + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ResponseCode + */ fun databaseFail( code: ResponseCode = ResponseCode.DATABASE_SELECT_FAILED, msg: String = "fail", data: T? = null ) = build(code, false, msg, data) diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Func.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Func.kt index 731a9f6..fd7163c 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Func.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Func.kt @@ -13,24 +13,38 @@ import java.io.Serializable */ @TableName("t_func") class Func : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 功能名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null /** - * 父ID + * Parent ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("parent_id") var parentId: Long? = null /** - * 菜单ID + * Menu ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("menu_id") var menuId: Long? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt index 806cba5..2f6afb8 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Group.kt @@ -12,42 +12,80 @@ import java.time.LocalDateTime */ @TableName("t_group") class Group : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 用户组名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null /** - * 启用 + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("enable") var enable: Int? = null /** - * 创建时间 + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("create_time", fill = FieldFill.INSERT) var createTime: LocalDateTime? = null /** - * 修改时间 + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("update_time", fill = FieldFill.INSERT_UPDATE) var updateTime: LocalDateTime? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null + /** + * Role list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Role + */ @TableField(exist = false) var roles: List? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/LoginUser.kt b/src/main/kotlin/top/fatweb/api/entity/permission/LoginUser.kt index 8809c72..1d9ce30 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/LoginUser.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/LoginUser.kt @@ -13,9 +13,17 @@ import java.time.ZoneOffset * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see UserDetails */ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) class LoginUser() : UserDetails { + /** + * User object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ lateinit var user: User @JsonIgnore diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt index ca889a7..37577ee 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Menu.kt @@ -13,30 +13,47 @@ import java.io.Serializable */ @TableName("t_menu") class Menu : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 菜单名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null /** * URL + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("url") var url: String? = null /** - * 父ID + * Parent ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("parent_id") var parentId: Long? = null /** - * 模块ID + * Module ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("module_id") var moduleId: Long? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt index 4cb3d11..37f2488 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Module.kt @@ -13,12 +13,20 @@ import java.io.Serializable */ @TableName("t_module") class Module : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 模块名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt index b0e9a68..106876f 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Operation.kt @@ -13,24 +13,38 @@ import java.io.Serializable */ @TableName("t_operation") class Operation : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 操作名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null /** - * 操作编码 + * Code + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("code") var code: String? = null /** - * 功能ID + * Function ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("func_id") var funcId: Long? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt index 1b6cf03..af610b4 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Power.kt @@ -13,12 +13,20 @@ import java.io.Serializable */ @TableName("t_power") class Power : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 权限类型 + * Type ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("type_id") var typeId: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/PowerRole.kt b/src/main/kotlin/top/fatweb/api/entity/permission/PowerRole.kt index 3d73b28..5651c12 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/PowerRole.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/PowerRole.kt @@ -11,26 +11,49 @@ import java.io.Serializable */ @TableName("t_power_role") class PowerRole : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 权限 + * Power ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("power_id") var powerId: Long? = null /** - * 角色 + * Role ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("role_id") var roleId: Long? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/PowerSet.kt b/src/main/kotlin/top/fatweb/api/entity/permission/PowerSet.kt index 4dfb94c..519c077 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/PowerSet.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/PowerSet.kt @@ -9,11 +9,39 @@ import java.io.Serializable * @since 1.0.0 */ class PowerSet : Serializable { + /** + * Module list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Module + */ var moduleList: List? = null + /** + * Menu list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Menu + */ var menuList: List? = null + /** + * Function list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Func + */ var funcList: List? = null + /** + * Operation list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Operation + */ var operationList: List? = null } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt b/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt index 3d0eead..e250336 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/PowerType.kt @@ -13,12 +13,20 @@ import java.io.Serializable */ @TableName("t_power_type") class PowerType : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 权限类型名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt b/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt index ede34ca..81efd8a 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/Role.kt @@ -12,54 +12,120 @@ import java.time.LocalDateTime */ @TableName("t_role") class Role : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 角色名 + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("name") var name: String? = null /** - * 启用 + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("enable") var enable: Int? = null /** - * 创建时间 + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("create_time", fill = FieldFill.INSERT) var createTime: LocalDateTime? = null /** - * 修改时间 + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("update_time", fill = FieldFill.INSERT_UPDATE) var updateTime: LocalDateTime? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null + /** + * Module list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Module + */ @TableField(exist = false) var modules: List? = null + /** + * Menu list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Menu + */ @TableField(exist = false) var menus: List? = null + /** + * Function list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Func + */ @TableField(exist = false) var funcs: List? = null + /** + * Operation list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Operation + */ @TableField(exist = false) var operations: List? = null + /** + * Power list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Power + */ @TableField(exist = false) var powers: List? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/RoleGroup.kt b/src/main/kotlin/top/fatweb/api/entity/permission/RoleGroup.kt index 6f37fc6..cb9e557 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/RoleGroup.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/RoleGroup.kt @@ -11,26 +11,49 @@ import java.io.Serializable */ @TableName("t_role_group") class RoleGroup : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 角色 + * Role ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("role_id") var roleId: Long? = null /** - * 群组 + * Group ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("group_id") var groupId: Long? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/User.kt b/src/main/kotlin/top/fatweb/api/entity/permission/User.kt index c63b362..b198788 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/User.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/User.kt @@ -19,107 +19,216 @@ class User() : Serializable { this.enable = if (enable) 1 else 0 } + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 用户名 + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("username") var username: String? = null /** - * 密码 + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("password") var password: String? = null /** - * 锁定 + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("locking") var locking: Int? = null /** - * 过期时间 + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("expiration") var expiration: LocalDateTime? = null /** - * 认证过期时间 + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("credentials_expiration") var credentialsExpiration: LocalDateTime? = null /** - * 启用 + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("enable") var enable: Int? = null /** - * 当前登录时间 + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("current_login_time") var currentLoginTime: LocalDateTime? = null /** - * 当前登录 IP + * Current login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("current_login_ip") var currentLoginIp: String? = null /** - * 上次登录时间 + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("last_login_time") var lastLoginTime: LocalDateTime? = null /** - * 上次登录 IP + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("last_login_ip") var lastLoginIp: String? = null /** - * 创建时间 + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("create_time") var createTime: LocalDateTime? = null /** - * 修改时间 + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("update_time") var updateTime: LocalDateTime? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null + /** + * User info + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfo + */ @TableField(exist = false) var userInfo: UserInfo? = null + /** + * Role list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Role + */ @TableField(exist = false) var roles: List? = null + /** + * Group list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Group + */ @TableField(exist = false) var groups: List? = null + /** + * Module list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Module + */ @TableField(exist = false) var modules: List? = null + /** + * Menu list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Menu + */ @TableField(exist = false) var menus: List? = null + /** + * Function list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Func + */ @TableField(exist = false) var funcs: List? = null + /** + * Operation list + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Operation + */ @TableField(exist = false) var operations: List? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/UserGroup.kt b/src/main/kotlin/top/fatweb/api/entity/permission/UserGroup.kt index 858f405..368253e 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/UserGroup.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/UserGroup.kt @@ -11,26 +11,49 @@ import java.io.Serializable */ @TableName("t_user_group") class UserGroup : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 用户 + * User ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("user_id") var userId: Long? = null /** - * 用户组 + * Group ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("group_id") var groupId: Long? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/UserInfo.kt b/src/main/kotlin/top/fatweb/api/entity/permission/UserInfo.kt index aff3d35..9635470 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/UserInfo.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/UserInfo.kt @@ -12,47 +12,87 @@ import java.time.LocalDateTime */ @TableName("t_user_info") class UserInfo : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null + /** + * User ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("user_id") var userId: Long? = null /** - * 昵称 + * Nickname + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("nickname") var nickname: String? = null /** - * 头像 + * Avatar in base64 + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("avatar") var avatar: String? = null /** - * 邮箱 + * Email + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("email") var email: String? = null /** - * 创建时间 + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("create_time", fill = FieldFill.INSERT) var createTime: LocalDateTime? = null /** - * 修改时间 + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("update_time", fill = FieldFill.INSERT_UPDATE) var updateTime: LocalDateTime? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt b/src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt index 94d5a4c..94cb0b6 100644 --- a/src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt +++ b/src/main/kotlin/top/fatweb/api/entity/permission/UserRole.kt @@ -11,26 +11,49 @@ import java.io.Serializable */ @TableName("t_user_role") class UserRole : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 用户 + * User ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("user_id") var userId: Long? = null /** - * 角色 + * Role ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("role_id") var roleId: Long? = null + /** + * Deleted + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("deleted") @TableLogic var deleted: Long? = null + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField("version") @Version var version: Int? = null diff --git a/src/main/kotlin/top/fatweb/api/entity/system/SysLog.kt b/src/main/kotlin/top/fatweb/api/entity/system/SysLog.kt index ae5bd91..4928382 100644 --- a/src/main/kotlin/top/fatweb/api/entity/system/SysLog.kt +++ b/src/main/kotlin/top/fatweb/api/entity/system/SysLog.kt @@ -14,94 +14,150 @@ import java.time.LocalDateTime */ @TableName("t_sys_log") class SysLog : Serializable { - + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableId("id") var id: Long? = null /** - * 日志类型 + * Log type + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("log_type") var logType: String? = null /** - * 操作用户 + * Operate user ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("operate_user_id") var operateUserId: Long? = null /** - * 操作时间 + * Operate time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("operate_time") var operateTime: LocalDateTime? = null /** - * 请求 URI + * Request URI + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("request_uri") var requestUri: String? = null /** - * 请求方式 + * Request method + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("request_method") var requestMethod: String? = null /** - * 请求参数 + * Request parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("request_params") var requestParams: String? = null /** - * 请求 IP + * Request IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("request_ip") var requestIp: String? = null /** - * 请求服务器地址 + * Request server address + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("request_server_address") var requestServerAddress: String? = null /** - * 是否异常 + * Is exception + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("exception") var exception: Int? = null /** - * 异常信息 + * Exception information + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("exception_info") var exceptionInfo: String? = null /** - * 开始时间 + * Start time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("start_time") var startTime: LocalDateTime? = null /** - * 结束时间 + * End time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime */ @TableField("end_time") var endTime: LocalDateTime? = null /** - * 执行时间 + * Execute time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("execute_time") var executeTime: Long? = null /** - * 用户代理 + * User agent + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ @TableField("user_agent") var userAgent: String? = null + /** + * Operate username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @TableField(exist = false) var operateUsername: String? = null diff --git a/src/main/kotlin/top/fatweb/api/exception/NoRecordFoundException.kt b/src/main/kotlin/top/fatweb/api/exception/NoRecordFoundException.kt index 42961fd..574c7ab 100644 --- a/src/main/kotlin/top/fatweb/api/exception/NoRecordFoundException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/NoRecordFoundException.kt @@ -5,5 +5,6 @@ package top.fatweb.api.exception * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see RuntimeException */ class NoRecordFoundException : RuntimeException("No record found") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/TokenHasExpiredException.kt b/src/main/kotlin/top/fatweb/api/exception/TokenHasExpiredException.kt index e8b3905..e5fb85d 100644 --- a/src/main/kotlin/top/fatweb/api/exception/TokenHasExpiredException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/TokenHasExpiredException.kt @@ -5,5 +5,6 @@ package top.fatweb.api.exception * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see RuntimeException */ class TokenHasExpiredException : RuntimeException("Token has expired") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/filter/ExceptionFilter.kt b/src/main/kotlin/top/fatweb/api/filter/ExceptionFilter.kt index a8a20a1..193f33c 100644 --- a/src/main/kotlin/top/fatweb/api/filter/ExceptionFilter.kt +++ b/src/main/kotlin/top/fatweb/api/filter/ExceptionFilter.kt @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see Filter */ @Component class ExceptionFilter : Filter { diff --git a/src/main/kotlin/top/fatweb/api/filter/JwtAuthenticationTokenFilter.kt b/src/main/kotlin/top/fatweb/api/filter/JwtAuthenticationTokenFilter.kt index 5f7b744..1af4dfb 100644 --- a/src/main/kotlin/top/fatweb/api/filter/JwtAuthenticationTokenFilter.kt +++ b/src/main/kotlin/top/fatweb/api/filter/JwtAuthenticationTokenFilter.kt @@ -20,13 +20,15 @@ import top.fatweb.api.util.WebUtil * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see RedisUtil + * @see OncePerRequestFilter */ @Component class JwtAuthenticationTokenFilter(private val redisUtil: RedisUtil) : OncePerRequestFilter() { override fun doFilterInternal( request: HttpServletRequest, response: HttpServletResponse, filterChain: FilterChain ) { - val tokenWithPrefix = request.getHeader(SecurityProperties.headerString) + val tokenWithPrefix = request.getHeader(SecurityProperties.headerKey) if (!StringUtils.hasText(tokenWithPrefix) || "/error/thrown" == request.servletPath) { filterChain.doFilter(request, response) diff --git a/src/main/kotlin/top/fatweb/api/handler/DataMetaObjectHandler.kt b/src/main/kotlin/top/fatweb/api/handler/DataMetaObjectHandler.kt index 3cb36fe..b85cbe1 100644 --- a/src/main/kotlin/top/fatweb/api/handler/DataMetaObjectHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/DataMetaObjectHandler.kt @@ -11,6 +11,7 @@ import java.time.ZoneOffset * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see MetaObjectHandler */ @Component class DataMetaObjectHandler : MetaObjectHandler { diff --git a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt index 5657310..10a32b5 100644 --- a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt @@ -30,6 +30,16 @@ import top.fatweb.avatargenerator.AvatarException class ExceptionHandler { private val logger: Logger = LoggerFactory.getLogger(this::class.java) + /** + * Handle all exception + * + * @param e Exception + * @return Response object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Exception + * @see ResponseResult + */ @ExceptionHandler(value = [Exception::class]) fun exceptionHandler(e: Exception): ResponseResult<*> { return when (e) { diff --git a/src/main/kotlin/top/fatweb/api/handler/JwtAccessDeniedHandler.kt b/src/main/kotlin/top/fatweb/api/handler/JwtAccessDeniedHandler.kt index 0a5342c..7e8f1f8 100644 --- a/src/main/kotlin/top/fatweb/api/handler/JwtAccessDeniedHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/JwtAccessDeniedHandler.kt @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see AccessDeniedHandler */ @Component class JwtAccessDeniedHandler : AccessDeniedHandler { diff --git a/src/main/kotlin/top/fatweb/api/handler/JwtAuthenticationEntryPointHandler.kt b/src/main/kotlin/top/fatweb/api/handler/JwtAuthenticationEntryPointHandler.kt index 381d2d0..fc477d4 100644 --- a/src/main/kotlin/top/fatweb/api/handler/JwtAuthenticationEntryPointHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/JwtAuthenticationEntryPointHandler.kt @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see AuthenticationEntryPoint */ @Component class JwtAuthenticationEntryPointHandler : AuthenticationEntryPoint { diff --git a/src/main/kotlin/top/fatweb/api/interceptor/SysLogInterceptor.kt b/src/main/kotlin/top/fatweb/api/interceptor/SysLogInterceptor.kt index 2ff7f02..1664ae3 100644 --- a/src/main/kotlin/top/fatweb/api/interceptor/SysLogInterceptor.kt +++ b/src/main/kotlin/top/fatweb/api/interceptor/SysLogInterceptor.kt @@ -27,6 +27,8 @@ import java.util.concurrent.Executor * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see Executor + * @see ISysLogService */ @ControllerAdvice class SysLogInterceptor( diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/FuncMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/FuncMapper.kt index 1d3a7ee..c20f3c6 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/FuncMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/FuncMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.Func * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Func */ @Mapper interface FuncMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt index 3b3f382..2413f06 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/GroupMapper.kt @@ -10,12 +10,43 @@ import top.fatweb.api.entity.permission.Group * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Group */ @Mapper interface GroupMapper : BaseMapper { + /** + * Select group in page + * + * @param page Pagination + * @param searchName Name to search for + * @param searchRegex Use regex + * @return Group in page + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IPage + */ fun selectPage(page: IPage, searchName: String?, searchRegex: Boolean): IPage + /** + * Select group with role list by list of group IDs + * + * @param groupIds List of group IDs + * @return Group with role list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Group + */ fun selectListWithRoleByIds(groupIds: List): List? + /** + * Select one group by ID + * + * @param id Group ID + * @return Group object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Group + */ fun selectOneById(id: Long): Group? } diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt index 6516989..f3527af 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/MenuMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.Menu * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Menu */ @Mapper interface MenuMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt index fbf183a..2c5041a 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/ModuleMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.Module * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Module */ @Mapper interface ModuleMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/OperationMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/OperationMapper.kt index 87d6571..c9e7dd1 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/OperationMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/OperationMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.Operation * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Operation */ @Mapper interface OperationMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt index 02dd26f..1dd1bb5 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.Power * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Power */ @Mapper interface PowerMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerRoleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerRoleMapper.kt index 4b220a9..643f5a0 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/PowerRoleMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/PowerRoleMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.PowerRole * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see PowerRole */ @Mapper interface PowerRoleMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleGroupMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleGroupMapper.kt index 3856cf1..39a3f04 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleGroupMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleGroupMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.RoleGroup * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see RoleGroup */ @Mapper interface RoleGroupMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt index 637174b..9c67184 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/RoleMapper.kt @@ -10,12 +10,43 @@ import top.fatweb.api.entity.permission.Role * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see Role */ @Mapper interface RoleMapper : BaseMapper { + /** + * Select role in page + * + * @param page Pagination + * @param searchName Name to search for + * @param searchRegex Use regex + * @return Role in page + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IPage + */ fun selectPage(page: IPage, searchName: String?, searchRegex: Boolean): IPage + /** + * Select role with power list by list of role IDs + * + * @param roleIds List of role IDs + * @return Role with power list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Role + */ fun selectListWithPowerByIds(roleIds: List): List? + /** + * Select one role by ID + * + * @param id Role ID + * @return Role object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Role + */ fun selectOneById(id: Long): Role? } diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/UserGroupMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/UserGroupMapper.kt index 972257f..aea7444 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/UserGroupMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/UserGroupMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.UserGroup * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see UserGroup */ @Mapper interface UserGroupMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/UserInfoMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/UserInfoMapper.kt index 2adb6fc..4313835 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/UserInfoMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/UserInfoMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.UserInfo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see UserInfo */ @Mapper interface UserInfoMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt index 069ec6e..88f3c39 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/UserMapper.kt @@ -11,20 +11,85 @@ import top.fatweb.api.entity.permission.User * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see User */ @Mapper interface UserMapper : BaseMapper { - fun selectOneWithPowerInfoByUsername(@Param("username")username: String): User? + /** + * Select one user with power and information by username + * + * @param username Username + * @return User object with power and information + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ + fun selectOneWithPowerInfoByUsername(@Param("username") username: String): User? + /** + * Select user in page + * + * @param page Pagination + * @param searchType Type of search + * @param searchValue Value to search for + * @param searchRegex Use regex + * @return User in page + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IPage + */ fun selectPage(page: IPage, searchType: String, searchValue: String?, searchRegex: Boolean): IPage + /** + * Select user with role and information list by list of user IDs + * + * @param userIds List of user IDs + * @return User with role and information list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ fun selectListWithRoleInfoByIds(userIds: List): List + /** + * Select one user by ID + * + * @param id User ID + * @return User object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ fun selectOneWithRoleInfoById(id: Long): User? + /** + * Select all user with information list + * + * @return User with information list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ fun selectListWithInfo(): List + /** + * Select user IDs list by list of role IDs + * + * @param roleIds List of role IDs + * @return User IDs list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun selectIdsWithRoleIds(roleIds: List): List + /** + * Select user IDs list by list of group IDs + * + * @param groupIds List of group IDs + * @return User IDs list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun selectIdsWithGroupIds(groupIds: List): List } diff --git a/src/main/kotlin/top/fatweb/api/mapper/permission/UserRoleMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/permission/UserRoleMapper.kt index bd6d894..10d7892 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/permission/UserRoleMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/permission/UserRoleMapper.kt @@ -9,6 +9,8 @@ import top.fatweb.api.entity.permission.UserRole * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see UserRole */ @Mapper interface UserRoleMapper : BaseMapper diff --git a/src/main/kotlin/top/fatweb/api/mapper/system/SysLogMapper.kt b/src/main/kotlin/top/fatweb/api/mapper/system/SysLogMapper.kt index 02d52ef..19db9bd 100644 --- a/src/main/kotlin/top/fatweb/api/mapper/system/SysLogMapper.kt +++ b/src/main/kotlin/top/fatweb/api/mapper/system/SysLogMapper.kt @@ -11,9 +11,28 @@ import java.time.LocalDateTime * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see BaseMapper + * @see SysLog */ @Mapper interface SysLogMapper : BaseMapper { + /** + * Select system log in page + * + * @param page Pagination + * @param logType List of log types + * @param requestMethod List of request methods + * @param searchRequestUrl Request URL to search for + * @param searchRegex Use regex + * @param searchStartTime Start time to search for + * @param searchEndTime end time to search for + * @return System log in page + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IPage + * @see SysLog + * @see LocalDateTime + */ fun selectPage( page: IPage, logType: List?, diff --git a/src/main/kotlin/top/fatweb/api/param/PageSortParam.kt b/src/main/kotlin/top/fatweb/api/param/PageSortParam.kt index c918fb2..b2c31c5 100644 --- a/src/main/kotlin/top/fatweb/api/param/PageSortParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/PageSortParam.kt @@ -4,23 +4,47 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.Min /** - * Page sort param + * Page sort parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ open class PageSortParam { + /** + * Current page number + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "分页页码", example = "1", defaultValue = "1") @field:Min(1, message = "Pagination page number must be a positive integer") var currentPage: Long = 1 + /** + * Size of page + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "分页大小", example = "20", defaultValue = "20") @field:Min(1, message = "The number of data per page must be a positive integer") var pageSize: Long = 20 + /** + * Field name to sort + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "排序字段", example = "id") var sortField: String? = null + /** + * Sort order by + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "排序方式", example = "desc", allowableValues = ["desc", "asc"]) var sortOrder: String? = null } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarBaseParam.kt b/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarBaseParam.kt index 669db14..b333daa 100644 --- a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarBaseParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarBaseParam.kt @@ -4,25 +4,66 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.Max import jakarta.validation.constraints.Pattern +/** + * Avatar base parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ open class AvatarBaseParam { + /** + * Seed to generate avatar + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "种子") var seed: Long? = null + /** + * Size of image + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "图像大小", defaultValue = "128") @field:Max(256, message = "Size must be less than or equal to 256") var size: Int? = null + /** + * Margin of image + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "外边距", defaultValue = "0") var margin: Int? = null + /** + * Padding of image + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "内边距", defaultValue = "0") var padding: Int? = null + /** + * List of colors to generate avatar + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(defaultValue = "颜色列表", example = "#FFFFFFAA") var colors: List? = null + /** + * Background of image + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(defaultValue = "背景颜色", example = "#FFFFFFAA") @field:Pattern(regexp = "^#[0-9a-fA-F]{6}|#[0-9a-fA-F]{8}$", message = "Background color must be a hex color code") var background: String? = null - } diff --git a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarEightBitParam.kt b/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarEightBitParam.kt deleted file mode 100644 index f47178b..0000000 --- a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarEightBitParam.kt +++ /dev/null @@ -1,8 +0,0 @@ -package top.fatweb.api.param.api.v1.avatar - -import io.swagger.v3.oas.annotations.media.Schema - -data class AvatarEightBitParam( - @Schema(description = "性别", defaultValue = "male", allowableValues = ["male", "female"]) - val gender: String?, -) : AvatarBaseParam() diff --git a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarGitHubParam.kt b/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarGitHubParam.kt index a431151..536c000 100644 --- a/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarGitHubParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/api/v1/avatar/AvatarGitHubParam.kt @@ -3,11 +3,29 @@ package top.fatweb.api.param.api.v1.avatar import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.Max +/** + * GitHub style avatar parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ data class AvatarGitHubParam( + /** + * Size of element + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "元素大小", defaultValue = "400") @field:Max(1000, message = "Element size must be less than or equal to 1000") val elementSize: Int = 400, + /** + * Precision of element + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "精确度", defaultValue = "5") val precision: Int = 5 ) : AvatarBaseParam() diff --git a/src/main/kotlin/top/fatweb/api/param/permission/LoginParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/LoginParam.kt index 1c99518..b937123 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/LoginParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/LoginParam.kt @@ -4,17 +4,29 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank /** - * Login param + * Login parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "登录请求参数") data class LoginParam( + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名", example = "test", required = true) @field:NotBlank(message = "Username can not be blank") val username: String? = null, + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "密码", example = "test123456", required = true) @field:NotBlank(message = "Password can not be blank") val password: String? = null diff --git a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupAddParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupAddParam.kt index 5a2df85..7fa60ea 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupAddParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupAddParam.kt @@ -4,20 +4,38 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank /** - * Group add param + * Add group parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "用户组添加请求参数") data class GroupAddParam( + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组名称") @field:NotBlank(message = "Name can not be blank") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * List of role IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID 列表") val roleIds: List? = null ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupDeleteParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupDeleteParam.kt index 91077a5..398f1c3 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupDeleteParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupDeleteParam.kt @@ -3,13 +3,19 @@ package top.fatweb.api.param.permission.group import io.swagger.v3.oas.annotations.media.Schema /** - * Group delete param + * Delete group parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "用户组删除请求参数") data class GroupDeleteParam( + /** + * List of group IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组 ID 列表") val ids: List ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupGetParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupGetParam.kt index d2a4fac..6ad8977 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupGetParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupGetParam.kt @@ -4,16 +4,29 @@ import io.swagger.v3.oas.annotations.media.Schema import top.fatweb.api.param.PageSortParam /** - * Group get param + * Get group parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see PageSortParam */ @Schema(description = "用户组查询请求参数") data class GroupGetParam( + /** + * Name to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询用户组名称") val searchName: String? = null, + /** + * Use regex + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false") val searchRegex: Boolean = false, ) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateParam.kt index 3a62411..deea985 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateParam.kt @@ -5,24 +5,48 @@ import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotNull /** - * Group update param + * Update group parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "用户组更新请求参数") data class GroupUpdateParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组 ID") @field:NotNull(message = "ID can not be null") val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组名称") @field:NotBlank(message = "Name can not be blank") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * List of role IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID 列表") val roleIds: List? = null ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateStatusParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateStatusParam.kt index b7c80d9..9d14c9d 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateStatusParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/group/GroupUpdateStatusParam.kt @@ -4,17 +4,29 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotNull /** - * Group change status param + * Update status of group parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "用户组更改状态请求参数") data class GroupUpdateStatusParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组 ID") @field:NotNull(message = "ID can not be null") val id: Long?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleAddParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleAddParam.kt index 2b92e60..0981784 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleAddParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleAddParam.kt @@ -4,20 +4,38 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank /** - * Role add param + * Add role parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "角色添加请求参数") data class RoleAddParam( + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色名称") @field:NotBlank(message = "Name can not be blank") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * List of power IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "权限 ID 列表") val powerIds: List? = null ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleDeleteParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleDeleteParam.kt index 3a3145e..03fa132 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleDeleteParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleDeleteParam.kt @@ -3,13 +3,19 @@ package top.fatweb.api.param.permission.role import io.swagger.v3.oas.annotations.media.Schema /** - * Role delete param + * Delete role parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "角色删除请求参数") data class RoleDeleteParam( + /** + * List of role IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID 列表") val ids: List ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleGetParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleGetParam.kt index 9ca5acf..959e1f5 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleGetParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleGetParam.kt @@ -4,16 +4,29 @@ import io.swagger.v3.oas.annotations.media.Schema import top.fatweb.api.param.PageSortParam /** - * Role get param + * Get role parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see PageSortParam */ @Schema(description = "角色查询请求参数") data class RoleGetParam( + /** + * Name to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询角色名称") val searchName: String? = null, + /** + * Use regex + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false") val searchRegex: Boolean = false, ) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateParam.kt index f69fb91..5fa6ffe 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateParam.kt @@ -5,24 +5,48 @@ import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotNull /** - * Role update param + * Update role parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "角色更新请求参数") data class RoleUpdateParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID") @field:NotNull(message = "Role id can not be null") val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色名称") @field:NotBlank(message = "Name can not be blank") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * List of power IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "权限 ID 列表") val powerIds: List? = null ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateStatusParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateStatusParam.kt index 48a3c4b..6c9116b 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateStatusParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/role/RoleUpdateStatusParam.kt @@ -4,17 +4,29 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotNull /** - * Role change status param + * Update status of role parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "角色更改状态请求参数") data class RoleUpdateStatusParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID") @field:NotNull(message = "Role id can not be null") val id: Long?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/param/permission/user/UserAddParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/user/UserAddParam.kt index 67d0048..f4fc726 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/user/UserAddParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/user/UserAddParam.kt @@ -4,39 +4,113 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank import java.time.LocalDateTime +/** + * Add user parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户添加请求参数") data class UserAddParam( + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名") @field:NotBlank(message = "Username can not be blank") val username: String?, + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "密码(为空自动生成随机密码)") val password: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "锁定", allowableValues = ["true", "false"], defaultValue = "false") val locking: Boolean = false, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间") val credentialsExpiration: LocalDateTime?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * Nickname + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "昵称") val nickname: String?, + /** + * Avatar base63 + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "头像") val avatar: String?, + /** + * Email + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "邮箱") val email: String?, + /** + * List of role IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID 列表") val roleIds: List?, + /** + * List of group IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组 ID 列表") val groupIds: List? ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/user/UserDeleteParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/user/UserDeleteParam.kt index 2ce54b1..785593a 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/user/UserDeleteParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/user/UserDeleteParam.kt @@ -3,13 +3,19 @@ package top.fatweb.api.param.permission.user import io.swagger.v3.oas.annotations.media.Schema /** - * User delete param + * Delete user parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ @Schema(description = "用户删除请求参数") data class UserDeleteParam( + /** + * List of user IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户 ID 列表") val ids: List ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/user/UserGetParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/user/UserGetParam.kt index 46d9e40..470c30d 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/user/UserGetParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/user/UserGetParam.kt @@ -4,19 +4,38 @@ import io.swagger.v3.oas.annotations.media.Schema import top.fatweb.api.param.PageSortParam /** - * User get param + * Get user parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see PageSortParam */ @Schema(description = "用户查询请求参数") data class UserGetParam( + /** + * Type of search + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "搜索类型", allowableValues = ["ALL", "ID", "USERNAME", "NICKNAME", "EMAIL"], defaultValue = "ALL") val searchType: String = "ALL", + /** + * Value to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询内容") val searchValue: String? = null, + /** + * Use regex + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false") val searchRegex: Boolean = false, ) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdateParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdateParam.kt index 99364ad..8d9f350 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdateParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdateParam.kt @@ -4,39 +4,113 @@ import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotNull import java.time.LocalDateTime +/** + * Update user parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户更新请求参数") data class UserUpdateParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户 ID") @field:NotNull(message = "ID can not be null") val id: Long?, + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名") val username: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "锁定", allowableValues = ["true", "false"], defaultValue = "false") val locking: Boolean = false, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间") val credentialsExpiration: LocalDateTime?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true") val enable: Boolean = true, + /** + * Nickname + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "昵称") val nickname: String?, + /** + * Avatar base64 + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "头像") val avatar: String?, + /** + * Email + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "邮箱") val email: String?, + /** + * List of role IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色 ID 列表") val roleIds: List?, + /** + * List of group IDs + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组 ID 列表") val groupIds: List? ) diff --git a/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdatePasswordParam.kt b/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdatePasswordParam.kt index 26f19bf..744a7e2 100644 --- a/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdatePasswordParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/permission/user/UserUpdatePasswordParam.kt @@ -5,16 +5,41 @@ import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotNull import java.time.LocalDateTime +/** + * Update password of user parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户更改密码请求参数") data class UserUpdatePasswordParam( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户 ID") @field:NotNull(message = "ID can not be null") val id: Long?, + /** + * New password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "新密码") @field:NotBlank(message = "Password can not be blank") val password: String?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间") val credentialsExpiration: LocalDateTime? ) diff --git a/src/main/kotlin/top/fatweb/api/param/system/MailSettingsParam.kt b/src/main/kotlin/top/fatweb/api/param/system/MailSettingsParam.kt index 6467b39..d4168f9 100644 --- a/src/main/kotlin/top/fatweb/api/param/system/MailSettingsParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/system/MailSettingsParam.kt @@ -1,9 +1,57 @@ package top.fatweb.api.param.system -data class MailSettingsParam ( +import io.swagger.v3.oas.annotations.media.Schema + +/** + * Mail settings parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ +@Schema(description = "邮件设置请求参数") +data class MailSettingsParam( + /** + * Host + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema(description = "SMTP 服务器") val host: String?, + + /** + * Port + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema(description = "端口号") val port: Int?, + + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema(description = "用户名") val username: String?, + + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema(description = "密码") val password: String?, + + /** + * Sender + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema(description = "发送者") val from: String? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/param/system/SysLogGetParam.kt b/src/main/kotlin/top/fatweb/api/param/system/SysLogGetParam.kt index 63c4ea9..c5083ad 100644 --- a/src/main/kotlin/top/fatweb/api/param/system/SysLogGetParam.kt +++ b/src/main/kotlin/top/fatweb/api/param/system/SysLogGetParam.kt @@ -6,16 +6,29 @@ import top.fatweb.api.param.PageSortParam import java.time.LocalDateTime /** - * System log get param + * Get system log parameters * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see PageSortParam */ @Schema(description = "获取系统日志请求参数") data class SysLogGetParam( + /** + * Log type + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "类型过滤(多个使用逗号分隔)", example = "INFO", allowableValues = ["INFO", "ERROR"]) val logType: String? = null, + /** + * Request method to filter + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema( description = "请求方式过滤(多个使用逗号分隔)", example = "GET,POST", @@ -23,16 +36,42 @@ data class SysLogGetParam( ) val requestMethod: String? = null, + /** + * Request URL to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询请求 Url") val searchRequestUrl: String? = null, + /** + * Use regex + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false") val searchRegex: Boolean = false, + /** + * Start time to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "查询开始时间") @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") val searchStartTime: LocalDateTime? = null, + /** + * End time to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "查询结束时间") @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") val searchEndTime: LocalDateTime? = null diff --git a/src/main/kotlin/top/fatweb/api/properties/AdminProperties.kt b/src/main/kotlin/top/fatweb/api/properties/AdminProperties.kt index a88b87c..0067b89 100644 --- a/src/main/kotlin/top/fatweb/api/properties/AdminProperties.kt +++ b/src/main/kotlin/top/fatweb/api/properties/AdminProperties.kt @@ -12,8 +12,35 @@ import org.springframework.stereotype.Component @Component @ConfigurationProperties("app.admin") object AdminProperties { + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var username = "admin" + + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var password: String? = null + + /** + * Nickname + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var nickname = "Administrator" + + /** + * Email + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var email = "admin@fatweb.top" } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/properties/SecurityProperties.kt b/src/main/kotlin/top/fatweb/api/properties/SecurityProperties.kt index 11ffda2..ed079bf 100644 --- a/src/main/kotlin/top/fatweb/api/properties/SecurityProperties.kt +++ b/src/main/kotlin/top/fatweb/api/properties/SecurityProperties.kt @@ -13,19 +13,67 @@ import java.util.concurrent.TimeUnit @Component @ConfigurationProperties("app.security") object SecurityProperties { - var headerString = "Authorization" + /** + * Key to get authentication from header + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + var headerKey = "Authorization" + /** + * Prefix of token + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var tokenPrefix = "Bearer " + /** + * TTL of JWT + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var jwtTtl = 2L + /** + * TTL unit of JWT + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var jwtTtlUnit = TimeUnit.HOURS + /** + * Key of JWT + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var jwtKey = "FatWeb" + /** + * Issuer of JWT + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var jwtIssuer = "FatWeb" + /** + * TTL of redis + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var redisTtl = 20L + /** + * TTL unit of redis + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var redisTtlUnit = TimeUnit.MINUTES } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/properties/ServerProperties.kt b/src/main/kotlin/top/fatweb/api/properties/ServerProperties.kt index a25a4b3..4be7eef 100644 --- a/src/main/kotlin/top/fatweb/api/properties/ServerProperties.kt +++ b/src/main/kotlin/top/fatweb/api/properties/ServerProperties.kt @@ -15,8 +15,20 @@ import java.time.ZonedDateTime @Component @ConfigurationProperties("app") object ServerProperties { + /** + * Version + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ lateinit var version: String + /** + * Build time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ lateinit var buildTime: String fun buildZoneDateTime(zoneId: ZoneId = ZoneId.systemDefault()): ZonedDateTime = diff --git a/src/main/kotlin/top/fatweb/api/service/api/v1/IAvatarService.kt b/src/main/kotlin/top/fatweb/api/service/api/v1/IAvatarService.kt index 0245fbf..9e1b17d 100644 --- a/src/main/kotlin/top/fatweb/api/service/api/v1/IAvatarService.kt +++ b/src/main/kotlin/top/fatweb/api/service/api/v1/IAvatarService.kt @@ -4,23 +4,106 @@ import top.fatweb.api.param.api.v1.avatar.AvatarBaseParam import top.fatweb.api.param.api.v1.avatar.AvatarGitHubParam import top.fatweb.api.vo.api.v1.avatar.AvatarBase64Vo +/** + * Avatar service interface + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ interface IAvatarService { + /** + * Generate triangle style avatar + * + * @param avatarBaseParam Avatar base parameters + * @return Avatar byte array + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see ByteArray + */ fun triangle(avatarBaseParam: AvatarBaseParam?): ByteArray + /** + * Generate triangle style avatar as base64 + * + * @param avatarBaseParam Avatar base parameters + * @return AvatarBase64Vo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see AvatarBase64Vo + */ fun triangleBase64(avatarBaseParam: AvatarBaseParam?): AvatarBase64Vo + /** + * Generate square style avatar + * + * @param avatarBaseParam Avatar base parameters + * @return Avatar byte array + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see ByteArray + */ fun square(avatarBaseParam: AvatarBaseParam?): ByteArray + /** + * Generate square style avatar as base64 + * + * @param avatarBaseParam Avatar base parameters + * @return AvatarBase64Vo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see AvatarBase64Vo + */ fun squareBase64(avatarBaseParam: AvatarBaseParam?): AvatarBase64Vo + /** + * Generate identicon style avatar + * + * @param avatarBaseParam Avatar base parameters + * @return Avatar byte array + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see ByteArray + */ fun identicon(avatarBaseParam: AvatarBaseParam?): ByteArray + /** + * Generate identicon style avatar as base64 + * + * @param avatarBaseParam Avatar base parameters + * @return AvatarBase64Vo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see AvatarBase64Vo + */ fun identiconBase64(avatarBaseParam: AvatarBaseParam?): AvatarBase64Vo + /** + * Generate GitHub style avatar + * + * @param avatarGitHubParam Avatar base parameters + * @return Avatar byte array + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see ByteArray + */ fun github(avatarGitHubParam: AvatarGitHubParam?): ByteArray + /** + * Generate GitHub style avatar as base64 + * + * @param avatarGitHubParam Avatar base parameters + * @return AvatarBase64Vo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see AvatarBaseParam + * @see AvatarBase64Vo + */ fun githubBase64(avatarGitHubParam: AvatarGitHubParam?): AvatarBase64Vo - -// fun eightBit(avatarEightBitParam: AvatarEightBitParam?): ByteArray - } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/service/api/v1/impl/AvatarServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/api/v1/impl/AvatarServiceImpl.kt index eba513c..1b3acae 100644 --- a/src/main/kotlin/top/fatweb/api/service/api/v1/impl/AvatarServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/api/v1/impl/AvatarServiceImpl.kt @@ -15,6 +15,13 @@ import java.awt.Color import kotlin.io.encoding.Base64 import kotlin.io.encoding.ExperimentalEncodingApi +/** + * Avatar service implement + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IAvatarService + */ @OptIn(ExperimentalEncodingApi::class) @Service class AvatarServiceImpl : IAvatarService { diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt index 27e2e48..b6d459b 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt @@ -12,9 +12,38 @@ import top.fatweb.api.vo.permission.TokenVo * @since 1.0.0 */ interface IAuthenticationService { + /** + * Login + * + * @param request + * @param user User object + * @return LoginVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see HttpServletRequest + * @see User + * @see LoginVo + */ fun login(request: HttpServletRequest, user: User): LoginVo + /** + * Logout + * + * @param token Token + * @return Logout result + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun logout(token: String): Boolean + /** + * Renew token + * + * @param token Token + * @return TokenVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see TokenVo + */ fun renewToken(token: String): TokenVo } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IFuncService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IFuncService.kt index fd33201..f482566 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IFuncService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IFuncService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.Func * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Func */ interface IFuncService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt index c79c7d0..4660759 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IGroupService.kt @@ -12,21 +12,95 @@ import top.fatweb.api.vo.permission.GroupWithRoleVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Group */ interface IGroupService : IService { + /** + * Get group in page + * + * @param groupGetParam Get group parameters + * @return PageVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupGetParam + * @see PageVo + * @see GroupWithRoleVo + */ fun getPage(groupGetParam: GroupGetParam?): PageVo + /** + * Get one group by ID + * + * @param id ID + * @return GroupWithRoleVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupWithRoleVo + */ fun getOne(id: Long): GroupWithRoleVo? + /** + * Get all group in list + * + * @return List of GroupVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupVo + */ fun listAll(): List + /** + * Add group + * + * @param groupAddParam Add group parameters + * @return GroupVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupAddParam + * @see GroupVo + */ fun add(groupAddParam: GroupAddParam): GroupVo? + /** + * Update group + * + * @param groupUpdateParam Update group parameters + * @return GroupVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupUpdateParam + * @see GroupVo + */ fun update(groupUpdateParam: GroupUpdateParam): GroupVo? + /** + * Update status of group + * + * @param groupUpdateStatusParam Update status of group parameters + * @return Result + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupUpdateStatusParam + */ fun status(groupUpdateStatusParam: GroupUpdateStatusParam): Boolean + /** + * Delete group by ID + * + * @param id ID + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun deleteOne(id: Long) + /** + * Delete group by list + * + * @param groupDeleteParam Delete group parameters + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupDeleteParam + */ fun delete(groupDeleteParam: GroupDeleteParam) } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt index 8267a1f..ae2216b 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IMenuService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.Menu * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Menu */ interface IMenuService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt index dc8bd0e..f2a06bf 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IModuleService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.Module * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Module */ interface IModuleService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IOperationService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IOperationService.kt index 3ec3418..fb36082 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IOperationService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IOperationService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.Operation * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Operation */ interface IOperationService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IPowerRoleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IPowerRoleService.kt index a603ed1..7cd4995 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IPowerRoleService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IPowerRoleService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.PowerRole * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see PowerRole */ interface IPowerRoleService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt index 4a50259..8e8611a 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IPowerService.kt @@ -9,7 +9,17 @@ import top.fatweb.api.vo.permission.PowerSetVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Power */ interface IPowerService : IService { + /** + * Get all power as list + * + * @return powerSetVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see PowerSetVo + */ fun getList(): PowerSetVo } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IRoleGroupService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IRoleGroupService.kt index a116c04..7ccddbc 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IRoleGroupService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IRoleGroupService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.RoleGroup * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see RoleGroup */ interface IRoleGroupService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt index bbac86e..8f944fa 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IRoleService.kt @@ -12,21 +12,95 @@ import top.fatweb.api.vo.permission.RoleWithPowerVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see Role */ interface IRoleService : IService { + /** + * Get role in page + * + * @param roleGetParam Get role parameters + * @return PageVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleGetParam + * @see PageVo + * @see RoleWithPowerVo + */ fun getPage(roleGetParam: RoleGetParam?): PageVo + /** + * Get user by ID + * + * @param id ID + * @return RoleWithPowerVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleWithPowerVo + */ fun getOne(id: Long): RoleWithPowerVo? + /** + * Get all role in list + * + * @return List of RoleVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleVo + */ fun listAll(): List + /** + * Add role + * + * @param roleAddParam Add role parameters + * @return RoleVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleAddParam + * @see RoleVo + */ fun add(roleAddParam: RoleAddParam): RoleVo? + /** + * Update role + * + * @param roleUpdateParam Update role parameters + * @return RoleVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleUpdateParam + * @see RoleVo + */ fun update(roleUpdateParam: RoleUpdateParam): RoleVo? + /** + * Update status of role + * + * @param roleUpdateStatusParam Update status of role parameters + * @return Result + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleUpdateStatusParam + */ fun status(roleUpdateStatusParam: RoleUpdateStatusParam): Boolean + /** + * Delete role by ID + * + * @param id ID + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun deleteOne(id: Long) + /** + * Delete role by list + * + * @param roleDeleteParam Delete role parameters + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleDeleteParam + */ fun delete(roleDeleteParam: RoleDeleteParam) } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IUserGroupService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IUserGroupService.kt index 4766259..8ff45d2 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IUserGroupService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IUserGroupService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.UserGroup * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see UserGroup */ interface IUserGroupService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IUserInfoService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IUserInfoService.kt index 9847a8c..4455d05 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IUserInfoService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IUserInfoService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.UserInfo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see UserInfo */ interface IUserInfoService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IUserRoleService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IUserRoleService.kt index 884aede..1b1ff58 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IUserRoleService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IUserRoleService.kt @@ -8,5 +8,7 @@ import top.fatweb.api.entity.permission.UserRole * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see UserRole */ interface IUserRoleService : IService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt index a65c178..5dc403a 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IUserService.kt @@ -14,29 +14,135 @@ import top.fatweb.api.vo.permission.UserWithRoleInfoVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see User */ interface IUserService : IService { + /** + * Get user with power by username + * + * @param username Username + * @return User object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see User + */ fun getUserWithPowerByUsername(username: String): User? + /** + * Get user information + * + * @return UserWithPowerInfoVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserWithPowerInfoVo + */ fun getInfo(): UserWithPowerInfoVo? + /** + * Get user in page + * + * @param userGetParam Get user parameters + * @return PageVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserGetParam + * @see PageVo + * @see UserWithRoleInfoVo + */ fun getPage(userGetParam: UserGetParam?): PageVo + /** + * Get one user by ID + * + * @param id ID + * @return UserWithRoleInfoVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserWithRoleInfoVo + */ fun getOne(id: Long): UserWithRoleInfoVo? - fun getList(): List + /** + * Get all user as list + * + * @return List of UserWithInfoVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserWithInfoVo + */ + fun listAll(): List + /** + * Add user + * + * @param userAddParam Add user parameters + * @return UserWithPasswordRoleInfoVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserAddParam + * @see UserWithPasswordRoleInfoVo + */ fun add(userAddParam: UserAddParam): UserWithPasswordRoleInfoVo? + /** + * Update user + * + * @param userUpdateParam Update user parameters + * @return UserWithRoleInfoVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserUpdateParam + * @see UserWithRoleInfoVo + */ fun update(userUpdateParam: UserUpdateParam): UserWithRoleInfoVo? + /** + * Update user password + * + * @param userUpdatePasswordParam Update user password parameters + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserUpdatePasswordParam + */ fun password(userUpdatePasswordParam: UserUpdatePasswordParam) + /** + * Delete user by ID + * + * @param id ID + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun deleteOne(id: Long) + /** + * Delete user by list + * + * @param userDeleteParam Delete user parameters + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserDeleteParam + */ fun delete(userDeleteParam: UserDeleteParam) - fun selectIdsWithRoleIds(roleIds: List): List + /** + * Get user IDs list by list of role IDs + * + * @param roleIds List of role IDs + * @return User IDs list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getIdsWithRoleIds(roleIds: List): List - fun selectIdsWithGroupIds(groupIds: List): List + /** + * Get user IDs list by list of group IDs + * + * @param groupIds List of group IDs + * @return User IDs list + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getIdsWithGroupIds(groupIds: List): List } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt index ccf1b30..6a9a0fe 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt @@ -26,6 +26,10 @@ import java.time.ZoneOffset * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see AuthenticationManager + * @see RedisUtil + * @see IUserService + * @see IAuthenticationService */ @Service class AuthenticationServiceImpl( diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/FuncServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/FuncServiceImpl.kt index 29c2686..e46d5eb 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/FuncServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/FuncServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IFuncService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see FuncMapper + * @see Func + * @see IFuncService */ @Service class FuncServiceImpl : ServiceImpl(), IFuncService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt index 0f0d046..63a9781 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/GroupServiceImpl.kt @@ -25,6 +25,13 @@ import top.fatweb.api.vo.permission.GroupWithRoleVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see RedisUtil + * @see IRoleGroupService + * @see IUserService + * @see ServiceImpl + * @see GroupMapper + * @see Group + * @see IGroupService */ @Service class GroupServiceImpl( @@ -140,7 +147,7 @@ class GroupServiceImpl( } private fun offlineUser(vararg groupIds: Long) { - val userIds = userService.selectIdsWithGroupIds(groupIds.toList()) + val userIds = userService.getIdsWithGroupIds(groupIds.toList()) WebUtil.offlineUser(redisUtil, *userIds.toLongArray()) } } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt index 81c5bb4..d4de1e0 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/MenuServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IMenuService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see MenuMapper + * @see Menu + * @see IMenuService */ @Service class MenuServiceImpl : ServiceImpl(), IMenuService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt index 3233761..ef2a479 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/ModuleServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IModuleService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see ModuleMapper + * @see Module + * @see IModuleService */ @Service class ModuleServiceImpl : ServiceImpl(), IModuleService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/OperationServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/OperationServiceImpl.kt index c2be9b3..e331784 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/OperationServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/OperationServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IOperationService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see OperationMapper + * @see Operation + * @see IOperationService */ @Service class OperationServiceImpl : ServiceImpl(), IOperationService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerRoleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerRoleServiceImpl.kt index bbf1147..89e2f1f 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerRoleServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerRoleServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IPowerRoleService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see PowerRoleMapper + * @see PowerRole + * @see IPowerRoleService */ @Service class PowerRoleServiceImpl : ServiceImpl(), IPowerRoleService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt index 1e08c83..4fca03a 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/PowerServiceImpl.kt @@ -13,6 +13,14 @@ import top.fatweb.api.service.permission.* * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IModuleService + * @see IMenuService + * @see IFuncService + * @see IOperationService + * @see ServiceImpl + * @see PowerMapper + * @see Power + * @see IPowerService */ @Service class PowerServiceImpl( diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleGroupServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleGroupServiceImpl.kt index 967d6eb..5d4e947 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleGroupServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleGroupServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IRoleGroupService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see RoleGroupMapper + * @see RoleGroup + * @see IRoleGroupService */ @Service class RoleGroupServiceImpl : ServiceImpl(), IRoleGroupService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt index 512ecda..db077d6 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/RoleServiceImpl.kt @@ -23,6 +23,15 @@ import top.fatweb.api.vo.permission.RoleWithPowerVo * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see RedisUtil + * @see IPowerRoleService + * @see IFuncService + * @see IMenuService + * @see IUserService + * @see ServiceImpl + * @see RoleMapper + * @see Role + * @see IRoleService */ @Service class RoleServiceImpl( @@ -173,7 +182,7 @@ class RoleServiceImpl( } private fun offlineUser(vararg roleIds: Long) { - val userIds = userService.selectIdsWithRoleIds(roleIds.toList()) + val userIds = userService.getIdsWithRoleIds(roleIds.toList()) WebUtil.offlineUser(redisUtil, *userIds.toLongArray()) } } diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserDetailsServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserDetailsServiceImpl.kt index 01efa6c..a1bce50 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserDetailsServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserDetailsServiceImpl.kt @@ -11,6 +11,8 @@ import top.fatweb.api.service.permission.IUserService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IUserService + * @see UserDetailsService */ @Service class UserDetailsServiceImpl(val userService: IUserService) : UserDetailsService { diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserGroupServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserGroupServiceImpl.kt index 8f49bec..30432eb 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserGroupServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserGroupServiceImpl.kt @@ -11,6 +11,10 @@ import top.fatweb.api.service.permission.IUserGroupService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see UserGroupMapper + * @see UserGroup + * @see IUserGroupService */ @Service class UserGroupServiceImpl : ServiceImpl(), IUserGroupService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserInfoServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserInfoServiceImpl.kt index 829dea5..fce770a 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserInfoServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserInfoServiceImpl.kt @@ -11,6 +11,9 @@ import top.fatweb.api.service.permission.IUserInfoService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see UserInfoMapper + * @see IUserInfoService */ @Service class UserInfoServiceImpl : ServiceImpl(), IUserInfoService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserRoleServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserRoleServiceImpl.kt index b60c513..ebe3d9d 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserRoleServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserRoleServiceImpl.kt @@ -11,6 +11,9 @@ import top.fatweb.api.service.permission.IUserRoleService * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see UserRoleMapper + * @see IUserRoleService */ @Service class UserRoleServiceImpl : ServiceImpl(), IUserRoleService diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt index 4ca0de6..e7cc6e0 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/UserServiceImpl.kt @@ -33,6 +33,19 @@ import java.time.ZoneOffset * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see PasswordEncoder + * @see RedisUtil + * @see IUserInfoService + * @see IModuleService + * @see IMenuService + * @see IFuncService + * @see IOperationService + * @see IUserRoleService + * @see IUserGroupService + * @see ServiceImpl + * @see UserMapper + * @see User + * @see IUserService */ @Service class UserServiceImpl( @@ -81,7 +94,7 @@ class UserServiceImpl( override fun getOne(id: Long) = baseMapper.selectOneWithRoleInfoById(id)?.let { UserConverter.userToUserWithRoleInfoVo(it) } - override fun getList() = baseMapper.selectListWithInfo().map { UserConverter.userToUserWithInfoVo(it) } + override fun listAll() = baseMapper.selectListWithInfo().map { UserConverter.userToUserWithInfoVo(it) } @Transactional override fun add(userAddParam: UserAddParam): UserWithPasswordRoleInfoVo? { @@ -249,7 +262,7 @@ class UserServiceImpl( WebUtil.offlineUser(redisUtil, *ids.toLongArray()) } - override fun selectIdsWithRoleIds(roleIds: List) = baseMapper.selectIdsWithRoleIds(roleIds) + override fun getIdsWithRoleIds(roleIds: List) = baseMapper.selectIdsWithRoleIds(roleIds) - override fun selectIdsWithGroupIds(groupIds: List) = baseMapper.selectIdsWithGroupIds(groupIds) + override fun getIdsWithGroupIds(groupIds: List) = baseMapper.selectIdsWithGroupIds(groupIds) } diff --git a/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt b/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt index 8a7cb2a..750e1be 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt @@ -3,8 +3,29 @@ package top.fatweb.api.service.system import top.fatweb.api.param.system.MailSettingsParam import top.fatweb.api.vo.system.SettingsVo +/** + * Settings service interface + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ interface ISettingsService { + /** + * Get all settings + * + * @return SettingVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see SettingsVo + */ fun get(): SettingsVo + /** + * Update mail settings + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MailSettingsParam + */ fun updateMail(mailSettingsParam: MailSettingsParam) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/service/system/ISysLogService.kt b/src/main/kotlin/top/fatweb/api/service/system/ISysLogService.kt index 4d04b01..4b3a431 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/ISysLogService.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/ISysLogService.kt @@ -10,7 +10,20 @@ import top.fatweb.api.param.system.SysLogGetParam * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see IService + * @see SysLog */ interface ISysLogService : IService { + /** + * Get system log in page + * + * @param sysLogGetParam Get system log parameters + * @return IPage object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see SysLogGetParam + * @see IPage + * @see SysLog + */ fun getPage(sysLogGetParam: SysLogGetParam?): IPage } diff --git a/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt index af32740..37ab1b1 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt @@ -8,6 +8,13 @@ import top.fatweb.api.settings.MailSettings import top.fatweb.api.settings.SettingsOperator import top.fatweb.api.vo.system.SettingsVo +/** + * Settings service implement + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ISettingsService + */ @Service class SettingsServiceImpl : ISettingsService { override fun get(): SettingsVo = SettingsConverter.systemSettingsToSettingsVo(SettingsOperator.settings()) diff --git a/src/main/kotlin/top/fatweb/api/service/system/impl/SysLogServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/system/impl/SysLogServiceImpl.kt index 6ecd5b1..4ea58fa 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/impl/SysLogServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/impl/SysLogServiceImpl.kt @@ -16,6 +16,10 @@ import top.fatweb.api.util.PageUtil * * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ServiceImpl + * @see SysLogMapper + * @see SysLog + * @see ISysLogService */ @Service class SysLogServiceImpl : ServiceImpl(), ISysLogService { diff --git a/src/main/kotlin/top/fatweb/api/settings/MailSettings.kt b/src/main/kotlin/top/fatweb/api/settings/MailSettings.kt index 43fbcb5..0d50f95 100644 --- a/src/main/kotlin/top/fatweb/api/settings/MailSettings.kt +++ b/src/main/kotlin/top/fatweb/api/settings/MailSettings.kt @@ -2,11 +2,51 @@ package top.fatweb.api.settings import com.fasterxml.jackson.annotation.JsonInclude +/** + * Mail settings entity + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonInclude(JsonInclude.Include.NON_EMPTY) data class MailSettings( + /** + * Host + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var host: String? = null, + + /** + * Port + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var port: Int? = null, + + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var username: String? = null, + + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var password: String? = null, + + /** + * Sender + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var from: String? = null, ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt b/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt index 4b20dff..d7892fa 100644 --- a/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt +++ b/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt @@ -8,6 +8,12 @@ import java.io.File import java.io.IOException import kotlin.reflect.KMutableProperty1 +/** + * Settings operator + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ object SettingsOperator { private const val SETTINGS_FILE_NAME = "data/config/settings.yaml" @@ -19,6 +25,14 @@ object SettingsOperator { getFromSettingsFile() } + /** + * Get settings from settings file + * + * @throws IOException + * @throws MismatchedInputException + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Throws(IOException::class, MismatchedInputException::class) private fun getFromSettingsFile() { if (settingFile.isDirectory) { @@ -47,10 +61,26 @@ object SettingsOperator { systemSettings = yamlMapper.readValue(settingFile) } + /** + * Save settings to settings file + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ private fun saveSettingsToFile() { yamlMapper.writeValue(settingFile, systemSettings) } + /** + * Set mail settings value + * + * @param field Field to set value. e.g. MailSettings::host + * @param value Value to set + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see KMutableProperty1 + * @see MailSettings + */ fun setMailValue(field: KMutableProperty1, value: V?) { systemSettings.mail?.let { if (field == MailSettings::password) { @@ -71,9 +101,27 @@ object SettingsOperator { saveSettingsToFile() } + /** + * Get value from mail settings + * + * @param field Field to get value from. e.g. MailSettings::host + * @return Value + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see KMutableProperty1 + * @see MailSettings + */ fun getMailValue(field: KMutableProperty1): V? = systemSettings.mail?.let(field) - fun settings() = systemSettings.copy( + /** + * Get system settings object + * + * @return System settings object (Copy) + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see SystemSettings + */ + fun settings(): SystemSettings = systemSettings.copy( mail = systemSettings.mail?.copy() ).apply { mail?.apply { @@ -83,6 +131,14 @@ object SettingsOperator { } } + /** + * Overwrite all settings + * + * @param systemSettings SystemSettings object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see SystemSettings + */ fun overwrite(systemSettings: SystemSettings) { this.systemSettings = systemSettings saveSettingsToFile() diff --git a/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt b/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt index b0f741e..8d49508 100644 --- a/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt +++ b/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt @@ -2,7 +2,19 @@ package top.fatweb.api.settings import com.fasterxml.jackson.annotation.JsonInclude +/** + * System setting entity + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonInclude(JsonInclude.Include.NON_EMPTY) data class SystemSettings( + /** + * Mail setting + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ var mail: MailSettings? = null ) diff --git a/src/main/kotlin/top/fatweb/api/util/ByteUtil.kt b/src/main/kotlin/top/fatweb/api/util/ByteUtil.kt index 737ae13..5e2747a 100644 --- a/src/main/kotlin/top/fatweb/api/util/ByteUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/ByteUtil.kt @@ -11,10 +11,94 @@ import kotlin.math.floor object ByteUtil { private const val BASE = 1024 + /** + * Byte unit + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ enum class ByteUnit { - B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB + /** + * Byte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + B, + + /** + * Kibibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + KiB, + + /** + * Mebibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + MiB, + + /** + * Gibibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + GiB, + + /** + * Tebibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + TiB, + + /** + * Pebibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + PiB, + + /** + * Exbibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + EiB, + + /** + * Zebibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + ZiB, + + /** + * Yobibyte + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + YiB } + /** + * Format byte size + * + * @param byteSize ByteSize + * @return Result + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun formatByteSize(byteSize: Long): String { if (byteSize <= -1) { return byteSize.toString() @@ -64,7 +148,7 @@ object ByteUtil { return format(size, ByteUnit.YiB) } - fun format(size: Double, unit: ByteUnit): String { + private fun format(size: Double, unit: ByteUnit): String { val precision = if (size * 1000 % 10 > 0) { 3 } else if (size * 100 % 10 > 0) { diff --git a/src/main/kotlin/top/fatweb/api/util/JwtUtil.kt b/src/main/kotlin/top/fatweb/api/util/JwtUtil.kt index 3071a4c..5d78472 100644 --- a/src/main/kotlin/top/fatweb/api/util/JwtUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/JwtUtil.kt @@ -18,9 +18,11 @@ object JwtUtil { private fun getUUID() = UUID.randomUUID().toString().replace("-", "") /** - * 生成加密后的秘钥 secretKey + * Generate encrypted secret key * - * @return 密钥 + * @return Secret key + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ private fun generalKey(): SecretKeySpec { val encodeKey = Base64.getDecoder().decode(SecurityProperties.jwtKey) @@ -30,13 +32,16 @@ object JwtUtil { private fun algorithm(): Algorithm = Algorithm.HMAC256(generalKey().toString()) /** - * 创建 token + * Create token * - * @param subject token 中存放的数据(json格式) - * @param ttl token 生存时间 - * @param timeUnit ttl 时间单位 - * @param uuid 唯一 ID - * @return jwt 串 + * @param subject Data stored in token (json format) + * @param ttl TTL of token + * @param timeUnit TTL unit of token + * @param uuid UUID + * @return JWT token + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see TimeUnit */ fun createJwt( subject: String, @@ -63,10 +68,13 @@ object JwtUtil { } /** - * 解析 jwt + * Parse JWT token * - * @param jwt jwt 串 - * @return 解析内容 + * @param jwt JWT token + * @return Parsed content + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see DecodedJWT */ fun parseJwt(jwt: String): DecodedJWT = JWT.require(algorithm()).build().verify(jwt) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/util/NumberUtil.kt b/src/main/kotlin/top/fatweb/api/util/NumberUtil.kt index ebc074b..41bb694 100644 --- a/src/main/kotlin/top/fatweb/api/util/NumberUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/NumberUtil.kt @@ -1,10 +1,34 @@ package top.fatweb.api.util +/** + * Number util + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ object NumberUtil { + /** + * Get random int value + * + * @param start Lower limit of random int value + * @param end Upper limit of random int value + * @return Random int value + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun getRandomInt(start: Int = Int.MIN_VALUE, end: Int = Int.MAX_VALUE): Int { return (start..end).random() } + /** + * Get random long value + * + * @param start Lower limit of random long value + * @param end Upper limit of random long value + * @return Random long value + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun getRandomLong(start: Long = Long.MIN_VALUE, end: Long = Long.MAX_VALUE): Long { return (start..end).random() } diff --git a/src/main/kotlin/top/fatweb/api/util/PageUtil.kt b/src/main/kotlin/top/fatweb/api/util/PageUtil.kt index e1039e8..c785e09 100644 --- a/src/main/kotlin/top/fatweb/api/util/PageUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/PageUtil.kt @@ -11,6 +11,18 @@ import top.fatweb.api.param.PageSortParam * @since 1.0.0 */ object PageUtil { + /** + * Set sort parameters into page object + * + * @param pageSortParam Sort parameters + * @param page Page object + * @param defaultOrder Default order by + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Page + * @see PageSortParam + * @see OrderItem + */ fun > setPageSort(pageSortParam: PageSortParam?, page: T, defaultOrder: OrderItem? = null) { if (pageSortParam?.sortField != null || pageSortParam?.sortOrder != null) { page.addOrder( diff --git a/src/main/kotlin/top/fatweb/api/util/RedisUtil.kt b/src/main/kotlin/top/fatweb/api/util/RedisUtil.kt index 278596b..784fc1b 100644 --- a/src/main/kotlin/top/fatweb/api/util/RedisUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/RedisUtil.kt @@ -15,107 +15,133 @@ import java.util.concurrent.TimeUnit @Component class RedisUtil(private val redisTemplate: RedisTemplate) { /** - * 设置有效时间 + * Set valid time * - * @param key 缓存的键 - * @param timeout 超时时间 - * @param timeUnit 时间颗粒度 - * @return true=设置成功;false=设置失败 + * @param key Cache key + * @param timeout Timeout + * @param timeUnit Unit of timeout + * @return true=Success;false=Fail + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see TimeUnit */ - fun setExpire(key: String, timeout: Long, timeUnit: TimeUnit = TimeUnit.SECONDS) = + fun setExpire(key: String, timeout: Long, timeUnit: TimeUnit = TimeUnit.SECONDS): Boolean = redisTemplate.expire(key, timeout, timeUnit) /** - * 获取有效时间 + * Get valid time * - * @param key 缓存的键 - * @return 有效时间 + * @param key Cache key + * @param timeUnit Unit of time + * @return Valid time + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun getExpire(key: String, timeUnit: TimeUnit = TimeUnit.SECONDS) = redisTemplate.getExpire(key, timeUnit) + fun getExpire(key: String, timeUnit: TimeUnit = TimeUnit.SECONDS): Long = redisTemplate.getExpire(key, timeUnit) /** - * 判断 key 是否存在 + * Determine whether key exists * - * @param key 缓存的键 - * @return true=存在; false=不存在 + * @param key Cache key + * @return true=exist; false=not exist + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun hasKey(key: String) = redisTemplate.hasKey(key) + fun hasKey(key: String): Boolean = redisTemplate.hasKey(key) /** - * 获得缓存的基本对象列表 + * Get list of cached key * - * @param pattern 字符串前缀 - * @return 对象列表 + * @param pattern Pattern of key + * @return List of key + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun keys(pattern: String): Set = redisTemplate.keys(pattern) /** - * 缓存基本的对象,Integer、String、实体类等 + * Cache basic object * - * @param key 缓存的键 - * @param value 缓存的值 + * @param key Cache key + * @param value Cache object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun setObject(key: String, value: Any) = redisTemplate.opsForValue().set(key, value) /** - * 缓存基本的对象,Integer、String、实体类等 + * Cache basic object * - * @param key 缓存的键 - * @param value 缓存的值 - * @param timeout 超时时间 - * @param timeUnit 时间颗粒度 + * @param key Cache key + * @param value Cache object + * @param timeout Timeout + * @param timeUnit Unit of timeout + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun setObject(key: String, value: Any, timeout: Long, timeUnit: TimeUnit = TimeUnit.SECONDS) = redisTemplate.opsForValue().set(key, value, timeout, timeUnit) /** - * 获得缓存的基本对象 + * Get cached basic object * - * @param key 缓存的键 - * @return 缓存的值 + * @param key cache key + * @return Cached object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun getObject(key: String) = redisTemplate.opsForValue().get(key) as? T + fun getObject(key: String): T? = redisTemplate.opsForValue().get(key) as? T /** - * 删除单个对象 + * Delete cached object * - * @param key 缓存的键 - * @return true=删除成功;false=删除失败 + * @param key Cache key + * @return true=success; false=fail + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun delObject(key: String) = redisTemplate.delete(key) + fun delObject(key: String): Boolean = redisTemplate.delete(key) /** - * 删除对象集合 + * Delete list of cached objects * - * @param collection 键集合 - * @return 删除个数 + * @param collection List of cache key + * @return Number of deleted objects + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun delObject(collection: Collection) = redisTemplate.delete(collection) + fun delObject(collection: Collection): Long = redisTemplate.delete(collection) /** - * 缓存 List 数据 + * Cache list of objects * - * @param key 缓存的键 - * @param dataList 缓存的 List 数据 - * @return 缓存的个数 + * @param key Cache key + * @param dataList List of objects + * @return Number of cached objects + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun setList(key: String, dataList: List) = redisTemplate.opsForList().rightPushAll(key, dataList) + fun setList(key: String, dataList: List): Long? = redisTemplate.opsForList().rightPushAll(key, dataList) /** - * 获得缓存的 List 数据 + * Get cached list of objects * - * @param key 缓存的键 - * @return 缓存的键对应的 List 数据 + * @param key Cache key + * @return List of cached objects + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun getList(key: String): List? = redisTemplate.opsForList().range(key, 0, -1) as? List /** - * 缓存 Set 数据 + * Cache set of objects * - * @param key 缓存的键 - * @param dataSet 缓存的 Set 数据 - * @return 缓存数据的对象 + * @param key Cache key + * @param dataSet Set of objects + * @return Bound set operations + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun setSet(key: String, dataSet: Set): BoundSetOperations { val boundSetOps: BoundSetOperations = redisTemplate.boundSetOps(key) @@ -126,63 +152,78 @@ class RedisUtil(private val redisTemplate: RedisTemplate) { } /** - * 获得缓存的 Set 数据 + * Get set of cached objects * - * @param key 缓存的键 - * @return 缓存的键对应的 Set 数据 + * @param key Cache key + * @return Set of cached object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun getSet(key: String): Set? = redisTemplate.opsForSet().members(key) as? Set /** - * 缓存 Map 数据 + * Cache map of objects * - * @param key 缓存的键 - * @param dataMap 缓存的 Map 数据 + * @param key Cache key + * @param dataMap Map of objects + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun setMap(key: String, dataMap: Map) = redisTemplate.opsForHash().putAll(key, dataMap) /** - * 获得缓存的 Map 数据 + * Get cached map of objects * - * @param key 缓存的键 - * @return 缓存的键对应的 Map 数据 + * @param key Cache key + * @return Map of cached objects + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun getMap(key: String): Map? = redisTemplate.opsForHash().entries(key) as? Map /** - * 往 Hash 中存入数据 + * Set value into cached map * - * @param key Redis 键 - * @param hKey Hash 键 - * @param value 值 + * @param key Cache key + * @param hKey Map key + * @param value Value in map + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun setMapValue(key: String, hKey: String, value: Any) = redisTemplate.opsForHash().put(key, hKey, value) /** - * 获取 Hash 中的数据 + * Get value in cached map * - * @param key Redis 键 - * @param hKey Hash 键 - * @return Hash 中的对象 + * @param key Cache key + * @param hKey Map key + * @return Value in map + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun getMapValue(key: String, hKey: String) = redisTemplate.opsForHash().get(key, hKey) /** - * 删除 Hash 中的数据 + * Delete value in cached map * - * @param key Redis 键 - * @param hKey Hash 键 + * @param key Cache key + * @param hKey Map key + * @return Number of deleted value + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ - fun delMapValue(key: String, hKey: String) = redisTemplate.opsForHash().delete(key, hKey) + fun delMapValue(key: String, hKey: String): Long = redisTemplate.opsForHash().delete(key, hKey) /** - * 获取多个 Hash 中的数据 + * Get multiple value in cached map * - * @param key Redis 键 - * @param hKeys Hash 键集合 - * @return Hash 对象集合 + * @param key Cache key + * @param hKeys List of map key + * @return HashMap object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 */ fun getMultiMapValue(key: String, hKeys: Collection): List = redisTemplate.opsForHash().multiGet(key, hKeys) diff --git a/src/main/kotlin/top/fatweb/api/util/StrUtil.kt b/src/main/kotlin/top/fatweb/api/util/StrUtil.kt index 0aef8cf..acc55fc 100644 --- a/src/main/kotlin/top/fatweb/api/util/StrUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/StrUtil.kt @@ -10,6 +10,15 @@ import java.util.regex.Pattern * @since 1.0.0 */ object StrUtil { + + /** + * Convert CamelCase string to underscore-delimited string + * + * @param str CamelCase string + * @return Underscore-delimited string + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun upperToUnderLetter(str: String?): String { str ?: let { return "" } @@ -25,6 +34,14 @@ object StrUtil { return stringBuilder.toString() } + /** + * Convert underscore-delimited string to CamelCase string + * + * @param str Underscore-delimited string + * @return CamelCase string + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun underToUpperLetter(str: String?): String { str ?: let { return "" } @@ -40,6 +57,14 @@ object StrUtil { return stringBuilder.toString() } + /** + * Get random password + * + * @param length Length of password + * @return Random password + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun getRandomPassword(length: Int): String { val characterSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" val password = StringBuilder() @@ -51,6 +76,14 @@ object StrUtil { return password.toString() } + /** + * Get MD5 of a string + * + * @param content Content + * @return MD5 of content + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ fun md5(content: String): String { val hash = MessageDigest.getInstance("MD5").digest(content.toByteArray()) val hex = StringBuilder(hash.size * 2) diff --git a/src/main/kotlin/top/fatweb/api/util/WebUtil.kt b/src/main/kotlin/top/fatweb/api/util/WebUtil.kt index ae280b5..9fb1432 100644 --- a/src/main/kotlin/top/fatweb/api/util/WebUtil.kt +++ b/src/main/kotlin/top/fatweb/api/util/WebUtil.kt @@ -12,17 +12,62 @@ import top.fatweb.api.properties.SecurityProperties * @since 1.0.0 */ object WebUtil { - fun getLoginUser() = if (SecurityContextHolder.getContext().authentication.principal is String) null + /** + * Get the user currently calling api + * + * @return LoginUser object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LoginUser + */ + fun getLoginUser(): LoginUser? = if (SecurityContextHolder.getContext().authentication.principal is String) null else SecurityContextHolder.getContext().authentication.principal as LoginUser - fun getLoginUserId() = getLoginUser()?.user?.id + /** + * Get ID of the user currently calling api + * + * @return User ID + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getLoginUserId(): Long? = getLoginUser()?.user?.id - fun getLoginUsername() = getLoginUser()?.user?.username + /** + * Get username of the user currently calling api + * + * @return Username + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getLoginUsername(): String? = getLoginUser()?.user?.username - fun getToken(tokenWithPrefix: String) = tokenWithPrefix.removePrefix(SecurityProperties.tokenPrefix) + /** + * Get token of the user currently calling api + * + * @return Token + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getToken(tokenWithPrefix: String): String = tokenWithPrefix.removePrefix(SecurityProperties.tokenPrefix) - fun getToken(request: HttpServletRequest) = getToken(request.getHeader(SecurityProperties.headerString)) + /** + * Get token of the user currently calling api + * + * @return Token + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun getToken(request: HttpServletRequest): String = getToken(request.getHeader(SecurityProperties.headerKey)) + /** + * Offline user + * + * @param redisUtil RedisUtil object + * @param userIds List of user IDs + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RedisUtil + */ fun offlineUser(redisUtil: RedisUtil, vararg userIds: Long) { val keys = HashSet() userIds.forEach { diff --git a/src/main/kotlin/top/fatweb/api/vo/PageVo.kt b/src/main/kotlin/top/fatweb/api/vo/PageVo.kt index dea12ec..2f20efd 100644 --- a/src/main/kotlin/top/fatweb/api/vo/PageVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/PageVo.kt @@ -10,18 +10,48 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "分页返回参数") data class PageVo( + /** + * Total number of records + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "总数量", example = "100") val total: Long, + /** + * Total number of pages + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "总页码", example = "10") val pages: Long, + /** + * Size of page + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "分页大小", example = "10") val size: Long, + /** + * Current page number + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "当前页码", example = "2") val current: Long, + /** + * Records in current page + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "数据") val records: List ) diff --git a/src/main/kotlin/top/fatweb/api/vo/api/v1/avatar/AvatarBase64Vo.kt b/src/main/kotlin/top/fatweb/api/vo/api/v1/avatar/AvatarBase64Vo.kt index 4560ef1..9266517 100644 --- a/src/main/kotlin/top/fatweb/api/vo/api/v1/avatar/AvatarBase64Vo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/api/v1/avatar/AvatarBase64Vo.kt @@ -10,6 +10,12 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "头像 Base64 返回参数") data class AvatarBase64Vo( + /** + * Base64 + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "base64") val base64: String? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/GroupWithRoleVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/GroupWithRoleVo.kt index 1fc80b2..7675cbf 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/GroupWithRoleVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/GroupWithRoleVo.kt @@ -13,21 +13,60 @@ import java.time.LocalDateTime * @since 1.0.0 */ data class GroupWithRoleVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组名", example = "Role") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", example = "true") val enable: Boolean?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * List of RoleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleVo + */ @Schema(description = "角色列表") val roles: List? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/LoginVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/LoginVo.kt index f98c485..2e724ba 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/LoginVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/LoginVo.kt @@ -11,16 +11,35 @@ import java.time.LocalDateTime */ @Schema(description = "登录返回参数") data class LoginVo( + /** + * Token + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema( description = "Token", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYTllYjFkYmVmZDQ0OWRkOThlOGNjNzZlNzZkMDgyNSIsInN1YiI6IjE3MDk5ODYwNTg2Nzk5NzU5MzgiLCJpc3MiOiJGYXRXZWIiLCJpYXQiOjE2OTY1MjgxMTcsImV4cCI6MTY5NjUzNTMxN30.U2ZsyrGk7NbsP-DJfdz9xgWSfect5r2iKQnlEsscAA8" ) val token: String, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema( description = "上次登录时间", example = "1900-01-01 00:00:00" ) val lastLoginTime: LocalDateTime?, + /** + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema( description = "上次登录 IP", example = "10.0.0.1" diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/PowerSetVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/PowerSetVo.kt index 7f88490..270c800 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/PowerSetVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/PowerSetVo.kt @@ -14,15 +14,43 @@ import top.fatweb.api.vo.permission.base.OperationVo */ @Schema(description = "权限集合返回参数") data class PowerSetVo( + /** + * List of ModuleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ModuleVo + */ @Schema(description = "模块列表") val moduleList: List?, + /** + * List of MenuVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MenuVo + */ @Schema(description = "菜单列表") val menuList: List?, + /** + * List of FuncVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see FuncVo + */ @Schema(description = "功能列表") val funcList: List?, + /** + * List of OperationVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see OperationVo + */ @Schema(description = "操作列表") val operationList: List? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/RoleWithPowerVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/RoleWithPowerVo.kt index 28cecf5..3b072ce 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/RoleWithPowerVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/RoleWithPowerVo.kt @@ -17,30 +17,90 @@ import java.time.LocalDateTime */ @Schema(description = "角色返回参数") data class RoleWithPowerVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色名", example = "Role") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", example = "true") val enable: Boolean?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * List of ModuleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ModuleVo + */ @Schema(description = "模块列表") val modules: List?, + /** + * List of MenuVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MenuVo + */ @Schema(description = "菜单列表") val menus: List?, + /** + * List of FuncVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see FuncVo + */ @Schema(description = "功能列表") val funcs: List?, + /** + * List of OperationVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see OperationVo + */ @Schema(description = "操作列表") val operations: List? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/TokenVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/TokenVo.kt index 141a157..7e1b501 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/TokenVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/TokenVo.kt @@ -10,6 +10,12 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "Token 返回参数") data class TokenVo( + /** + * Token + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema( description = "Token", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYTllYjFkYmVmZDQ0OWRkOThlOGNjNzZlNzZkMDgyNSIsInN1YiI6IjE3MDk5ODYwNTg2Nzk5NzU5MzgiLCJpc3MiOiJGYXRXZWIiLCJpYXQiOjE2OTY1MjgxMTcsImV4cCI6MTY5NjUzNTMxN30.U2ZsyrGk7NbsP-DJfdz9xgWSfect5r2iKQnlEsscAA8" diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithInfoVo.kt index 5837990..d6c153e 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithInfoVo.kt @@ -14,42 +14,127 @@ import java.time.LocalDateTime */ @Schema(description = "用户信息返回参数") data class UserWithInfoVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名", example = "User") val username: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否锁定", example = "false") val locking: Boolean?, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间", example = "1900-01-01T00:00:00.000Z") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间", example = "1900-01-01T00:00:00.000Z") val credentialsExpiration: LocalDateTime?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否启用", example = "true") val enable: Boolean?, + /** + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录时间", example = "1900-01-01T00:00:00.000Z") val currentLoginTime: LocalDateTime?, + /** + * Current login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "当前登录 IP", example = "1.1.1.1") val currentLoginIp: String?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "最后登录时间", example = "1900-01-01T00:00:00.000Z") val lastLoginTime: LocalDateTime?, + /** + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "最后登录 IP", example = "1.1.1.1") val lastLoginIp: String?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * User information object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfoVo + */ @Schema(description = "用户资料") val userInfo: UserInfoVo? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPasswordRoleInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPasswordRoleInfoVo.kt index bf6d6d6..74381ac 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPasswordRoleInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPasswordRoleInfoVo.kt @@ -16,51 +16,156 @@ import java.time.LocalDateTime */ @Schema(description = "用户密码角色信息返回参数") data class UserWithPasswordRoleInfoVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名", example = "User") val username: String?, + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "密码") val password: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否锁定", example = "false") val locking: Boolean?, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间", example = "1900-01-01T00:00:00.000Z") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间", example = "1900-01-01T00:00:00.000Z") val credentialsExpiration: LocalDateTime?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否启用", example = "true") val enable: Boolean?, + /** + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录时间", example = "1900-01-01T00:00:00.000Z") val currentLoginTime: LocalDateTime?, + /** + * Current login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "当前登录 IP", example = "1.1.1.1") val currentLoginIp: String?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "最后登录时间", example = "1900-01-01T00:00:00.000Z") val lastLoginTime: LocalDateTime?, + /** + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "最后登录 IP", example = "1.1.1.1") val lastLoginIp: String?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * User information object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfoVo + */ @Schema(description = "用户资料") val userInfo: UserInfoVo?, + /** + * List of RoleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleVo + */ @Schema(description = "角色列表") val roles: List?, + /** + * List of GroupVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupVo + */ @Schema(description = "用户组列表") val groups: List? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPowerInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPowerInfoVo.kt index bdc4aa6..652120b 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPowerInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithPowerInfoVo.kt @@ -14,54 +14,164 @@ import java.time.LocalDateTime */ @Schema(description = "用户权限信息返回参数") data class UserWithPowerInfoVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名", example = "User") val username: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否锁定", example = "false") val locking: Boolean?, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间", example = "1900-01-01T00:00:00.000Z") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间", example = "1900-01-01T00:00:00.000Z") val credentialsExpiration: LocalDateTime?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否启用", example = "true") val enable: Boolean?, + /** + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录时间", example = "1900-01-01T00:00:00.000Z") val currentLoginTime: LocalDateTime?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录 IP", example = "1.1.1.1") val currentLoginIp: String?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "最后登录时间", example = "1900-01-01T00:00:00.000Z") val lastLoginTime: LocalDateTime?, + /** + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "最后登录 IP", example = "1.1.1.1") val lastLoginIp: String?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * User information object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfoVo + */ @Schema(description = "用户资料") val userInfo: UserInfoVo?, + /** + * List of ModuleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "模块列表") val modules: List?, + /** + * List of MenuVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "菜单列表") val menus: List?, + /** + * List of FuncVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "功能列表") val funcs: List?, + /** + * List of OperationVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "操作列表") val operations: List? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithRoleInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithRoleInfoVo.kt index 9e97a4e..099ffed 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/UserWithRoleInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/UserWithRoleInfoVo.kt @@ -16,48 +16,149 @@ import java.time.LocalDateTime */ @Schema(description = "用户角色信息返回参数") data class UserWithRoleInfoVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户名", example = "User") val username: String?, + /** + * Locking + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否锁定", example = "false") val locking: Boolean?, + /** + * Expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "过期时间", example = "1900-01-01T00:00:00.000Z") val expiration: LocalDateTime?, + /** + * Credentials expiration time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "认证过期时间", example = "1900-01-01T00:00:00.000Z") val credentialsExpiration: LocalDateTime?, + /** + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "是否启用", example = "true") val enable: Boolean?, + /** + * Current login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录时间", example = "1900-01-01T00:00:00.000Z") val currentLoginTime: LocalDateTime?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "当前登录 IP", example = "1.1.1.1") val currentLoginIp: String?, + /** + * Last login time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "最后登录时间", example = "1900-01-01T00:00:00.000Z") val lastLoginTime: LocalDateTime?, + /** + * Last login IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "最后登录 IP", example = "1.1.1.1") val lastLoginIp: String?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * User information object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfoVo + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime?, + /** + * User information object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see UserInfoVo + */ @Schema(description = "用户资料") val userInfo: UserInfoVo?, + /** + * List of RoleVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see RoleVo + */ @Schema(description = "角色列表") val roles: List?, + /** + * List of GroupVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see GroupVo + */ @Schema(description = "用户组列表") val groups: List? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/FuncVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/FuncVo.kt index 66c0651..1e859ee 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/FuncVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/FuncVo.kt @@ -10,14 +10,38 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "功能返回参数") data class FuncVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "功能名", example = "AddButton") val name: String?, + /** + * Parent ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "父 ID") val parentId: Long?, + /** + * Menu ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "菜单 ID") val menuId: Long? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/GroupVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/GroupVo.kt index f82822a..98baf46 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/GroupVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/GroupVo.kt @@ -13,18 +13,50 @@ import java.time.LocalDateTime */ @Schema(description = "用户组返回参数") data class GroupVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户组名", example = "Group") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", example = "true") val enable: Boolean?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/MenuVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/MenuVo.kt index 8d2a9ee..7fb3b84 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/MenuVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/MenuVo.kt @@ -10,17 +10,47 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "菜单返回参数") data class MenuVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "菜单名", example = "System") val name: String?, + /** + * URL + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "URL", example = "/system") val url: String?, + /** + * Parent ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "父 ID") val parentId: Long?, + /** + * Module ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "模块 ID") val moduleId: Long? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/ModuleVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/ModuleVo.kt index 51def6d..a3d7fbe 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/ModuleVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/ModuleVo.kt @@ -10,8 +10,20 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "模块返回参数") data class ModuleVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "模块名", example = "系统") val name: String? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/OperationVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/OperationVo.kt index efbde75..0221c52 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/OperationVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/OperationVo.kt @@ -10,14 +10,38 @@ import io.swagger.v3.oas.annotations.media.Schema */ @Schema(description = "操作返回参数") data class OperationVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "操作名", example = "Add User") val name: String?, + /** + * Code + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "操作编码", example = "system:user:add") val code: String?, + /** + * Function ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "功能 ID") val funcId: Long? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/RoleVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/RoleVo.kt index 97eba22..ffe5e60 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/RoleVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/RoleVo.kt @@ -13,18 +13,50 @@ import java.time.LocalDateTime */ @Schema(description = "角色返回参数") data class RoleVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Name + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "角色名", example = "Role") val name: String?, + /** + * Enable + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "启用", example = "true") val enable: Boolean?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/permission/base/UserInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/permission/base/UserInfoVo.kt index 824f0e6..d3721b5 100644 --- a/src/main/kotlin/top/fatweb/api/vo/permission/base/UserInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/permission/base/UserInfoVo.kt @@ -13,25 +13,69 @@ import java.time.LocalDateTime */ @Schema(description = "用户资料返回参数") data class UserInfoVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * User ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户ID") @JsonSerialize(using = ToStringSerializer::class) val userId: Long?, + /** + * Nickname + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "昵称", example = "User") val nickname: String?, + /** + * Avatar base64 + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "头像") val avatar: String?, + /** + * Email + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "邮箱", example = "user@fatweb.top") val email: String?, + /** + * Create time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "创建时间", example = "1900-01-01T00:00:00.000Z") val createTime: LocalDateTime?, + /** + * Update time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "修改时间", example = "1900-01-01T00:00:00.000Z") val updateTime: LocalDateTime? ) diff --git a/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt index 85f19c9..b88a84c 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt @@ -1,13 +1,66 @@ package top.fatweb.api.vo.system +/** + * System settings value object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ data class SettingsVo( + /** + * MailSettingVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see MailSettingsVo + */ val mail: MailSettingsVo? ) { + /** + * Mail settings value object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ data class MailSettingsVo( + /** + * Host + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val host: String?, + + /** + * Port + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val port: Int?, + + /** + * Username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val username: String?, + + /** + * Password + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val password: String?, + + /** + * Sender + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ val from: String? ) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/system/SysLogVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/SysLogVo.kt index fc5435b..184bbef 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/SysLogVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/SysLogVo.kt @@ -13,52 +13,151 @@ import java.time.LocalDateTime */ @Schema(description = "获取系统日志返回参数") data class SysLogVo( + /** + * ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @JsonSerialize(using = ToStringSerializer::class) val id: Long?, + /** + * Log type + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "日志类型") val logType: String?, + /** + * Operate user ID + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "操作用户 ID") @JsonSerialize(using = ToStringSerializer::class) val operateUserId: Long?, + /** + * Operate time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "操作时间") val operateTime: LocalDateTime?, + /** + * Request URI + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "请求 Uri") val requestUri: String?, + /** + * Request Method + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "请求方式") val requestMethod: String?, + /** + * Request parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "请求参数") val requestParams: String?, + /** + * Request IP + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "请求 IP") val requestIp: String?, + /** + * Request server address + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "请求服务器地址") val requestServerAddress: String?, + /** + * Is exception + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "是否异常") val exception: Boolean?, + /** + * Exception information + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "异常信息") val exceptionInfo: String?, + /** + * Start time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "开始时间") val startTime: LocalDateTime?, + /** + * End time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see LocalDateTime + */ @Schema(description = "结束时间") val endTime: LocalDateTime?, + /** + * Execute time + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "执行时间") val executeTime: Long?, + /** + * User agent + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "用户代理") val userAgent: String?, + /** + * Operate username + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ @Schema(description = "操作用户名") val operateUsername: String? )