Feat: all - support multiple platforms

This commit is contained in:
2024-03-18 17:26:08 +08:00
parent 9fe6333aeb
commit cc4e6bd960
39 changed files with 415 additions and 78 deletions

View File

@@ -8,9 +8,12 @@ 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.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
import top.fatweb.oxygen.api.param.tool.ToolBaseGetParam
import top.fatweb.oxygen.api.param.tool.ToolBaseUpdateParam
import top.fatweb.oxygen.api.service.tool.IToolBaseService
import top.fatweb.oxygen.api.vo.PageVo
import top.fatweb.oxygen.api.vo.tool.ToolBaseVo
/**
@@ -40,6 +43,24 @@ class BaseController(
fun getOne(@PathVariable id: Long): ResponseResult<ToolBaseVo> =
ResponseResult.databaseSuccess(data = toolBaseService.getOne(id))
/**
* Get tool base paging information
*
* @param toolBaseGetParam Get tool base parameters
* @return Response object includes tool base paging information
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBaseGetParam
* @see ResponseResult
* @see PageVo
* @see ToolBaseVo
*/
@Operation(summary = "获取基板")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:base')")
fun get(toolBaseGetParam: ToolBaseGetParam?): ResponseResult<PageVo<ToolBaseVo>> =
ResponseResult.databaseSuccess(data = toolBaseService.get(toolBaseGetParam))
/**
* Get tool base list
*
@@ -49,11 +70,12 @@ class BaseController(
* @see ResponseResult
* @see ToolBaseVo
*/
@Operation(summary = "获取基板")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:base', 'system:tool:add:template', 'system:tool:modify:template')")
fun get(): ResponseResult<List<ToolBaseVo>> =
ResponseResult.databaseSuccess(data = toolBaseService.get())
@Operation(summary = "获取基板列表")
@GetMapping("/list")
@PreAuthorize("hasAnyAuthority('system:tool:add:template', 'system:tool:modify:template')")
fun list(): ResponseResult<List<ToolBaseVo>> =
ResponseResult.databaseSuccess(data = toolBaseService.getList())
/**
* Add tool base

View File

@@ -2,11 +2,13 @@ package top.fatweb.oxygen.api.controller.tool
import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import jakarta.validation.constraints.NotNull
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.entity.tool.ToolBase
import top.fatweb.oxygen.api.param.tool.ToolCreateParam
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
import top.fatweb.oxygen.api.param.tool.ToolUpgradeParam
@@ -37,8 +39,8 @@ class EditController(
*/
@Operation(summary = "获取模板")
@GetMapping("/template")
fun getTemplate(): ResponseResult<List<ToolTemplateVo>> =
ResponseResult.databaseSuccess(data = editService.getTemplate())
fun getTemplate(platform: ToolBase.Platform): ResponseResult<List<ToolTemplateVo>> =
ResponseResult.databaseSuccess(data = editService.getTemplate(platform))
/**
* Get tool template by ID
@@ -137,11 +139,12 @@ class EditController(
fun detail(
@PathVariable username: String,
@PathVariable toolId: String,
@PathVariable ver: String
@PathVariable ver: String,
platform: ToolBase.Platform
): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(
ResponseCode.DATABASE_SELECT_SUCCESS,
data = editService.detail(username.trim(), toolId.trim(), ver.trim())
data = editService.detail(username.trim(), toolId.trim(), ver.trim(), platform)
)
/**

View File

@@ -9,8 +9,10 @@ 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
import top.fatweb.oxygen.api.param.tool.ToolTemplateGetParam
import top.fatweb.oxygen.api.param.tool.ToolTemplateUpdateParam
import top.fatweb.oxygen.api.service.tool.IToolTemplateService
import top.fatweb.oxygen.api.vo.PageVo
import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo
/**
@@ -41,19 +43,22 @@ class TemplateController(
ResponseResult.databaseSuccess(data = toolTemplateService.getOne(id))
/**
* Get tool template list
* Get tool template paging information
*
* @return Response object includes tool template list
* @param toolTemplateGetParam Get tool template parameters
* @return Response object includes tool template paging information
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolTemplateGetParam
* @see ResponseResult
* @see PageVo
* @see ToolTemplateVo
*/
@Operation(summary = "获取模板")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:template')")
fun get(): ResponseResult<List<ToolTemplateVo>> =
ResponseResult.databaseSuccess(data = toolTemplateService.get())
fun get(toolTemplateGetParam: ToolTemplateGetParam?): ResponseResult<PageVo<ToolTemplateVo>> =
ResponseResult.databaseSuccess(data = toolTemplateService.get(toolTemplateGetParam))
/**
* Add tool template