Automatically remove spaces on both sides of parameters

This commit is contained in:
2024-02-26 15:33:37 +08:00
parent 1edfeffbf4
commit 3e612af044
46 changed files with 285 additions and 51 deletions

View File

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.*
@@ -38,6 +39,7 @@ class AuthenticationController(
* @see ResponseResult
* @see RegisterVo
*/
@Trim
@Operation(summary = "注册")
@PostMapping("/register")
fun register(
@@ -75,6 +77,7 @@ class AuthenticationController(
* @see VerifyParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "验证邮箱")
@PostMapping("/verify")
fun verify(@Valid @RequestBody verifyParam: VerifyParam): ResponseResult<Nothing> {
@@ -95,6 +98,7 @@ class AuthenticationController(
* @see ForgetParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "忘记密码")
@PostMapping("/forget")
fun forget(request: HttpServletRequest, @Valid @RequestBody forgetParam: ForgetParam): ResponseResult<Nothing> {
@@ -139,6 +143,7 @@ class AuthenticationController(
* @see ResponseResult
* @see LoginVo
*/
@Trim
@Operation(summary = "登录")
@PostMapping("/login")
fun login(request: HttpServletRequest, @Valid @RequestBody loginParam: LoginParam): ResponseResult<LoginVo> =

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.group.*
@@ -52,6 +53,7 @@ class GroupController(
* @see PageVo
* @see GroupWithRoleVo
*/
@Trim
@Operation(summary = "获取用户组")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:group:query:all')")
@@ -88,6 +90,7 @@ class GroupController(
* @see ResponseResult
* @see GroupVo
*/
@Trim
@Operation(summary = "添加用户组")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:group:add:one')")
@@ -107,6 +110,7 @@ class GroupController(
* @see ResponseResult
* @see GroupVo
*/
@Trim
@Operation(summary = "修改用户组")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:group:modify:one')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.role.*
@@ -51,6 +52,7 @@ class RoleController(
* @see ResponseResult
* @see RoleWithPowerVo
*/
@Trim
@Operation(summary = "获取角色")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:role:query:all')")
@@ -88,6 +90,7 @@ class RoleController(
* @see ResponseResult
* @see RoleVo
*/
@Trim
@Operation(summary = "添加角色")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:role:add:one')")
@@ -107,6 +110,7 @@ class RoleController(
* @see ResponseResult
* @see RoleVo
*/
@Trim
@Operation(summary = "修改角色")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:role:modify:one')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.user.*
@@ -50,10 +51,11 @@ class UserController(
* @see ResponseResult
* @see UserWithPowerInfoVo
*/
@Trim
@Operation(summary = "获取指定用户基本信息")
@GetMapping("/info/{username}")
fun getBasicInfo(@PathVariable username: String): ResponseResult<UserWithInfoVo> =
ResponseResult.databaseSuccess(data = userService.getBasicInfo(username))
ResponseResult.databaseSuccess(data = userService.getBasicInfo(username.trim()))
/**
* Update current user information
@@ -65,6 +67,7 @@ class UserController(
* @see UserInfoUpdateParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新当前用户信息")
@PatchMapping("info")
fun updateInfo(@RequestBody @Valid userInfoUpdateParam: UserInfoUpdateParam): ResponseResult<Nothing> =
@@ -116,6 +119,7 @@ class UserController(
* @see ResponseResult
* @see UserWithRoleInfoVo
*/
@Trim
@Operation(summary = "获取用户")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:user:query:all')")
@@ -135,6 +139,7 @@ class UserController(
* @see ResponseResult
* @see UserWithPasswordRoleInfoVo
*/
@Trim
@Operation(summary = "添加用户")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:user:add:one')")
@@ -154,6 +159,7 @@ class UserController(
* @see ResponseResult
* @see UserWithRoleInfoVo
*/
@Trim
@Operation(summary = "修改用户")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:user:modify:one')")

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.*
@@ -56,6 +57,7 @@ class SettingsController(
* @see BaseSettingsParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新基础设置")
@PutMapping("/base")
@PreAuthorize("hasAnyAuthority('system:settings:modify:base')")
@@ -88,6 +90,7 @@ class SettingsController(
* @see MailSettingsParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新邮件设置")
@PutMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -106,6 +109,7 @@ class SettingsController(
* @see MailSendParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "邮件发送测试")
@PostMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -139,6 +143,7 @@ class SettingsController(
* @see SensitiveWordAddParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "添加敏感词")
@PostMapping("/sensitive")
@PreAuthorize("hasAnyAuthority('system:settings:modify:sensitive')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.GetMapping
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.SysLogGetParam
@@ -34,6 +35,7 @@ class SysLogController(
* @see ResponseResult
* @see SysLogVo
*/
@Trim
@Operation(summary = "获取")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:log:query:all')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
@@ -65,6 +66,7 @@ class BaseController(
* @see ResponseResult
* @see ToolBaseVo
*/
@Trim
@Operation(summary = "新增基板")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:base')")
@@ -85,6 +87,7 @@ class BaseController(
* @see ResponseResult
* @see ToolBaseVo
*/
@Trim
@Operation(summary = "更新基板")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:base')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
@@ -65,6 +66,7 @@ class CategoryController(
* @see ResponseResult
* @see ToolCategoryVo
*/
@Trim
@Operation(summary = "新增类别")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:category')")
@@ -85,6 +87,7 @@ class CategoryController(
* @see ResponseResult
* @see ToolCategoryVo
*/
@Trim
@Operation(summary = "更新类别")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:category')")

View File

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCreateParam
@@ -79,6 +80,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "创建工具")
@PostMapping
fun create(@RequestBody @Valid toolCreateParam: ToolCreateParam): ResponseResult<ToolVo> =
@@ -95,6 +97,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "升级工具")
@PatchMapping
fun upgrade(@RequestBody @Valid toolUpgradeParam: ToolUpgradeParam): ResponseResult<ToolVo> =
@@ -138,7 +141,7 @@ class EditController(
): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(
ResponseCode.DATABASE_SELECT_SUCCESS,
data = editService.detail(username, toolId, ver)
data = editService.detail(username.trim(), toolId.trim(), ver.trim())
)
/**
@@ -152,6 +155,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "更新工具")
@PutMapping
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> =

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
@@ -52,6 +53,7 @@ class ManagementController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(summary = "获取工具")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:tool')")

View File

@@ -1,9 +1,11 @@
package top.fatweb.oxygen.api.controller.tool
import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolStoreGetParam
@@ -34,6 +36,8 @@ class StoreController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(description = "获取商店工具")
@GetMapping
fun get(@Valid toolStoreGetParam: ToolStoreGetParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = storeService.getPage(toolStoreGetParam))
@@ -51,7 +55,9 @@ class StoreController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(description = "获取商店指定用户工具")
@GetMapping("/{username}")
fun get(@PathVariable username: String, @Valid pageSortParam: PageSortParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = storeService.getPage(pageSortParam, username))
ResponseResult.databaseSuccess(data = storeService.getPage(pageSortParam, username.trim()))
}

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam
@@ -65,6 +66,7 @@ class TemplateController(
* @see ResponseResult
* @see ToolTemplateVo
*/
@Trim
@Operation(summary = "添加模板")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:template')")
@@ -85,6 +87,7 @@ class TemplateController(
* @see ResponseResult
* @see ToolTemplateVo
*/
@Trim
@Operation(summary = "更新模板")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:template')")