Refactor:1; Feat:1 #27

Merged
FatttSnake merged 2 commits from FatttSnake into dev 2024-05-10 05:15:18 +08:00
13 changed files with 46 additions and 42 deletions
Showing only changes of commit 491e6cf1cd - Show all commits

View File

@@ -7,7 +7,7 @@ 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.entity.tool.Platform
import top.fatweb.oxygen.api.param.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolCreateParam
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
@@ -40,7 +40,7 @@ class EditController(
*/
@Operation(summary = "获取模板")
@GetMapping("/template")
fun getTemplate(platform: ToolBase.Platform): ResponseResult<List<ToolTemplateVo>> =
fun getTemplate(platform: Platform): ResponseResult<List<ToolTemplateVo>> =
ResponseResult.databaseSuccess(data = editService.getTemplate(platform))
/**
@@ -144,7 +144,7 @@ class EditController(
@PathVariable username: String,
@PathVariable toolId: String,
@PathVariable ver: String,
platform: ToolBase.Platform
platform: Platform
): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(
ResponseCode.DATABASE_SELECT_SUCCESS,

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.entity.tool
import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue
/**
* Platform enum
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
enum class Platform(@field:EnumValue @field:JsonValue val code: String) {
WEB("WEB"), DESKTOP("DESKTOP"), ANDROID("ANDROID")
}

View File

@@ -66,10 +66,10 @@ class Tool : Serializable {
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@TableField("platform")
var platform: ToolBase.Platform? = null
var platform: Platform? = null
/**
* Description

View File

@@ -1,7 +1,6 @@
package top.fatweb.oxygen.api.entity.tool
import com.baomidou.mybatisplus.annotation.*
import com.fasterxml.jackson.annotation.JsonValue
import java.io.Serializable
import java.time.LocalDateTime
@@ -13,16 +12,6 @@ import java.time.LocalDateTime
*/
@TableName("t_b_tool_base")
class ToolBase : Serializable {
/**
* Platform enum
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
enum class Platform(@field:EnumValue @field:JsonValue val code: String) {
WEB("WEB"), DESKTOP("DESKTOP"), ANDROID("ANDROID")
}
/**
* ID
*

View File

@@ -53,10 +53,10 @@ class ToolTemplate : Serializable {
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@TableField("platform")
var platform: ToolBase.Platform? = null
var platform: Platform? = null
/**
* Entry point

View File

@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.core.metadata.IPage
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import top.fatweb.oxygen.api.entity.tool.Platform
import top.fatweb.oxygen.api.entity.tool.Tool
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.entity.tool.ToolTemplate
/**
@@ -75,13 +75,14 @@ interface EditMapper : BaseMapper<Tool> {
* @return List of tool object
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see Platform
* @see Tool
*/
fun selectDetail(
@Param("username") username: String,
@Param("toolId") toolId: String,
@Param("ver") ver: String,
@Param("platform") platform: ToolBase.Platform,
@Param("platform") platform: Platform,
@Param("operator") operator: String?
): Tool?
}

View File

@@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.entity.tool.Platform
/**
* Add tool base parameters
@@ -30,9 +30,9 @@ data class ToolBaseAddParam(
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@Schema(description = "平台")
@field:NotNull(message = "Platform can not be null")
val platform: ToolBase.Platform?
val platform: Platform?
)

View File

@@ -5,7 +5,7 @@ import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.entity.tool.Platform
/**
* Upgrade tool parameters
@@ -36,11 +36,11 @@ data class ToolUpgradeParam(
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@Schema(description = "平台")
@field:NotNull(message = "Platform can not be null")
val platform: ToolBase.Platform?,
val platform: Platform?,
/**

View File

@@ -1,8 +1,8 @@
package top.fatweb.oxygen.api.service.tool
import com.baomidou.mybatisplus.extension.service.IService
import top.fatweb.oxygen.api.entity.tool.Platform
import top.fatweb.oxygen.api.entity.tool.Tool
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.param.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolCreateParam
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
@@ -27,10 +27,10 @@ interface IEditService : IService<Tool> {
* @return List of ToolTemplateVo object
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
* @see ToolTemplateVo
*/
fun getTemplate(platform: ToolBase.Platform): List<ToolTemplateVo>
fun getTemplate(platform: Platform): List<ToolTemplateVo>
/**
* Get tool template by ID
@@ -122,10 +122,10 @@ interface IEditService : IService<Tool> {
* @return ToolVo object
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
* @see ToolVo
*/
fun detail(username: String, toolId: String, ver: String, platform: ToolBase.Platform): ToolVo
fun detail(username: String, toolId: String, ver: String, platform: Platform): ToolVo
/**
* Submit tool review

View File

@@ -41,7 +41,7 @@ class EditServiceImpl(
private val toolDataService: IToolDataService,
private val rToolCategoryService: IRToolCategoryService
) : ServiceImpl<EditMapper, Tool>(), IEditService {
override fun getTemplate(platform: ToolBase.Platform): List<ToolTemplateVo> =
override fun getTemplate(platform: Platform): List<ToolTemplateVo> =
toolTemplateService.list(
KtQueryWrapper(ToolTemplate())
.eq(ToolTemplate::platform, platform)
@@ -227,7 +227,7 @@ class EditServiceImpl(
return ToolConverter.toolPageToToolPageVo(toolPage)
}
override fun detail(username: String, toolId: String, ver: String, platform: ToolBase.Platform): ToolVo {
override fun detail(username: String, toolId: String, ver: String, platform: Platform): ToolVo {
if (username == "!" && WebUtil.getLoginUserId() == null) {
throw NoRecordFoundException()
}

View File

@@ -3,7 +3,7 @@ package top.fatweb.oxygen.api.vo.tool
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.entity.tool.Platform
import java.time.LocalDateTime
/**
@@ -55,10 +55,10 @@ data class ToolBaseVo(
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@Schema(description = "平台")
val platform: ToolBase.Platform?,
val platform: Platform?,
/**
* Compiled

View File

@@ -3,7 +3,7 @@ package top.fatweb.oxygen.api.vo.tool
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.entity.tool.Platform
import java.time.LocalDateTime
/**
@@ -55,10 +55,10 @@ data class ToolTemplateVo(
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@Schema(description = "平台")
val platform: ToolBase.Platform?,
val platform: Platform?,
/**
* Entry point

View File

@@ -3,8 +3,8 @@ package top.fatweb.oxygen.api.vo.tool
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.entity.tool.Platform
import top.fatweb.oxygen.api.entity.tool.Tool
import top.fatweb.oxygen.api.entity.tool.ToolBase
import top.fatweb.oxygen.api.vo.permission.UserWithInfoVo
import java.time.LocalDateTime
@@ -56,10 +56,10 @@ data class ToolVo(
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ToolBase.Platform
* @see Platform
*/
@Schema(description = "平台")
val platform: ToolBase.Platform?,
val platform: Platform?,
/**
* Description