From 09f800c16b5603f420f9ca5bdc7897caec9be689 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 8 Mar 2024 17:50:42 +0800 Subject: [PATCH 1/4] Refactor: token - change the way to splice redisKey --- .../oxygen/api/filter/JwtAuthenticationTokenFilter.kt | 2 +- .../service/permission/impl/AuthenticationServiceImpl.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/filter/JwtAuthenticationTokenFilter.kt b/src/main/kotlin/top/fatweb/oxygen/api/filter/JwtAuthenticationTokenFilter.kt index a3ab155..a103133 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/filter/JwtAuthenticationTokenFilter.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/filter/JwtAuthenticationTokenFilter.kt @@ -38,7 +38,7 @@ class JwtAuthenticationTokenFilter(private val redisUtil: RedisUtil) : OncePerRe val token = WebUtil.getToken(tokenWithPrefix) JwtUtil.parseJwt(token) - val redisKeyPattern = "${SecurityProperties.jwtIssuer}_login_*:" + token + val redisKeyPattern = "${SecurityProperties.jwtIssuer}_login_*:${token}" val redisKeys = redisUtil.keys(redisKeyPattern) if (redisKeys.isEmpty()) { throw TokenHasExpiredException() diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/permission/impl/AuthenticationServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/permission/impl/AuthenticationServiceImpl.kt index 81372a3..1143cc1 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/permission/impl/AuthenticationServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/permission/impl/AuthenticationServiceImpl.kt @@ -264,19 +264,19 @@ class AuthenticationServiceImpl( override fun logout(token: String): Boolean { val loginUser = WebUtil.getLoginUser() ?: throw TokenHasExpiredException() - return redisUtil.delObject("${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:" + token) + return redisUtil.delObject("${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:${token}") } override fun renewToken(token: String): TokenVo { val loginUser = WebUtil.getLoginUser() ?: throw TokenHasExpiredException() - val oldRedisKey = "${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:" + token + val oldRedisKey = "${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:${token}" redisUtil.delObject(oldRedisKey) val jwt = JwtUtil.createJwt(WebUtil.getLoginUserId().toString()) jwt ?: throw RuntimeException("Login failed") - val redisKey = "${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:" + jwt + val redisKey = "${SecurityProperties.jwtIssuer}_login_${loginUser.user.id}:${jwt}" redisUtil.setObject( redisKey, loginUser, SecurityProperties.redisTtl, SecurityProperties.redisTtlUnit ) @@ -390,7 +390,7 @@ class AuthenticationServiceImpl( jwt ?: throw RuntimeException("Login failed") - val redisKey = "${SecurityProperties.jwtIssuer}_login_${userId}:" + jwt + val redisKey = "${SecurityProperties.jwtIssuer}_login_${userId}:${jwt}" redisUtil.setObject(redisKey, loginUser, SecurityProperties.redisTtl, SecurityProperties.redisTtlUnit) return LoginVo(jwt, loginUser.user.id, loginUser.user.currentLoginTime, loginUser.user.currentLoginIp) -- 2.49.1 From 49ad18b545824fa48bcb18cd3c2ce5d84e3cea2f Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 8 Mar 2024 17:51:58 +0800 Subject: [PATCH 2/4] Fix: exception handler - fix wrong response code when catch DisabledException --- .../top/fatweb/oxygen/api/handler/ExceptionHandler.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt b/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt index 9acf7f8..d9969c0 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/handler/ExceptionHandler.kt @@ -93,10 +93,10 @@ class ExceptionHandler { is DisabledException -> { logger.debug(e.localizedMessage, e) - ResponseResult.fail(ResponseCode.PERMISSION_USER_CREDENTIALS_EXPIRED, "User has been disabled", null) + ResponseResult.fail(ResponseCode.PERMISSION_USER_DISABLE, "User has been disabled", null) } - is TokenExpiredException -> { + is TokenExpiredException, is TokenHasExpiredException -> { logger.debug(e.localizedMessage, e) ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_HAS_EXPIRED, e.localizedMessage, null) } @@ -120,11 +120,6 @@ class ExceptionHandler { ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_ILLEGAL, "Token illegal", null) } - is TokenHasExpiredException -> { - logger.debug(e.localizedMessage, e) - ResponseResult.fail(ResponseCode.PERMISSION_TOKEN_HAS_EXPIRED, e.localizedMessage, null) - } - is AccessDeniedException -> { logger.debug(e.localizedMessage, e) ResponseResult.fail(ResponseCode.PERMISSION_ACCESS_DENIED, "Access Denied", null) -- 2.49.1 From 9fe6333aebdb5e42ae4bcd4cf8adb008dc1b3c3c Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 8 Mar 2024 17:53:49 +0800 Subject: [PATCH 3/4] Fix: JwtUtil - fix general key bug --- src/main/kotlin/top/fatweb/oxygen/api/OxygenApiApplication.kt | 2 +- src/main/kotlin/top/fatweb/oxygen/api/util/JwtUtil.kt | 2 +- src/main/resources/application-config-template.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/OxygenApiApplication.kt b/src/main/kotlin/top/fatweb/oxygen/api/OxygenApiApplication.kt index 146c2fb..6bfaadb 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/OxygenApiApplication.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/OxygenApiApplication.kt @@ -59,7 +59,7 @@ fun main(args: Array) { OxygenApiApplication::class.java.getResource("/application-config-template.yml")?.readText()?.let { File("data/application-config.example.yml").writeText( it.replace( - "\$uuid\$", UUID.randomUUID().toString().replace("-", "") + "\$uuid\$", UUID.randomUUID().toString() ) ) } diff --git a/src/main/kotlin/top/fatweb/oxygen/api/util/JwtUtil.kt b/src/main/kotlin/top/fatweb/oxygen/api/util/JwtUtil.kt index a831d5f..8622a6b 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/util/JwtUtil.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/util/JwtUtil.kt @@ -25,7 +25,7 @@ object JwtUtil { * @since 1.0.0 */ private fun generalKey(): SecretKeySpec { - val encodeKey = Base64.getDecoder().decode(SecurityProperties.jwtKey) + val encodeKey = Base64.getEncoder().encode(SecurityProperties.jwtKey.toByteArray()) return SecretKeySpec(encodeKey, 0, encodeKey.size, "AES") } diff --git a/src/main/resources/application-config-template.yml b/src/main/resources/application-config-template.yml index dbe25d5..6747dbc 100644 --- a/src/main/resources/application-config-template.yml +++ b/src/main/resources/application-config-template.yml @@ -11,7 +11,7 @@ app: # token-prefix: "Bearer " # Token prefix # jwt-ttl: 2 # The life of token # jwt-ttl-unit: hours # Unit of life of token [nanoseconds, microseconds, milliseconds, seconds, minutes, hours, days] - jwt-key: $uuid$ # Key to generate token (Only numbers and letters allow) + jwt-key: $uuid$ # Key to generate token # jwt-issuer: Oxygen # Token issuer # redis-ttl: 20 # The life of token in redis # redis-ttl-unit: minutes # Unit of life of token in redis [nanoseconds, microseconds, milliseconds, seconds, minutes, hours, days] -- 2.49.1 From cc4e6bd96085df6c5230506d9292fcab333add62 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 18 Mar 2024 17:26:08 +0800 Subject: [PATCH 4/4] Feat: all - support multiple platforms --- .../api/controller/tool/BaseController.kt | 32 ++++++++++++--- .../api/controller/tool/EditController.kt | 11 ++++-- .../api/controller/tool/TemplateController.kt | 13 +++++-- .../api/converter/tool/ToolBaseConverter.kt | 26 ++++++++++++- .../api/converter/tool/ToolConverter.kt | 1 + .../converter/tool/ToolTemplateConverter.kt | 21 ++++++++++ .../top/fatweb/oxygen/api/entity/tool/Tool.kt | 12 +++++- .../fatweb/oxygen/api/entity/tool/ToolBase.kt | 23 ++++++++++- .../oxygen/api/entity/tool/ToolTemplate.kt | 12 +++++- .../oxygen/api/mapper/tool/EditMapper.kt | 2 + .../api/mapper/tool/ManagementMapper.kt | 1 + .../api/mapper/tool/ToolTemplateMapper.kt | 6 ++- .../api/param/permission/user/UserAddParam.kt | 4 +- .../param/permission/user/UserUpdateParam.kt | 4 +- .../oxygen/api/param/tool/ToolBaseAddParam.kt | 15 ++++++- .../oxygen/api/param/tool/ToolBaseGetParam.kt | 27 +++++++++++++ .../api/param/tool/ToolManagementGetParam.kt | 15 ++++++- .../api/param/tool/ToolTemplateGetParam.kt | 27 +++++++++++++ .../api/param/tool/ToolTemplateUpdateParam.kt | 9 ----- .../oxygen/api/param/tool/ToolUpgradeParam.kt | 14 +++++++ .../oxygen/api/service/tool/IEditService.kt | 10 +++-- .../api/service/tool/IToolBaseService.kt | 19 ++++++++- .../api/service/tool/IToolTemplateService.kt | 10 +++-- .../api/service/tool/impl/EditServiceImpl.kt | 28 ++++++++----- .../tool/impl/ManagementServiceImpl.kt | 3 +- .../service/tool/impl/ToolBaseServiceImpl.kt | 25 +++++++++++- .../tool/impl/ToolTemplateServiceImpl.kt | 21 +++++++--- .../fatweb/oxygen/api/vo/tool/ToolBaseVo.kt | 11 ++++++ .../oxygen/api/vo/tool/ToolTemplateVo.kt | 11 ++++++ .../top/fatweb/oxygen/api/vo/tool/ToolVo.kt | 11 ++++++ .../resources/application-config-template.yml | 3 ++ ..._0_0_240115__Add_table_'t_b_tool_main'.sql | 5 ++- ..._240119__Add_table_'t_b_tool_template'.sql | 3 +- ..._0_0_240120__Add_table_'t_b_tool_base'.sql | 3 +- src/main/resources/mapper/tool/EditMapper.xml | 5 +++ .../mapper/tool/ManagementMapper.xml | 8 ++++ .../resources/mapper/tool/StoreMapper.xml | 1 + .../resources/mapper/tool/ToolBaseMapper.xml | 2 + .../mapper/tool/ToolTemplateMapper.xml | 39 ++++++++++++------- 39 files changed, 415 insertions(+), 78 deletions(-) create mode 100644 src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseGetParam.kt create mode 100644 src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateGetParam.kt diff --git a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/BaseController.kt b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/BaseController.kt index 60cf7a4..5f607bf 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/BaseController.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/BaseController.kt @@ -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 = 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> = + 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> = - ResponseResult.databaseSuccess(data = toolBaseService.get()) + @Operation(summary = "获取基板列表") + @GetMapping("/list") + @PreAuthorize("hasAnyAuthority('system:tool:add:template', 'system:tool:modify:template')") + fun list(): ResponseResult> = + ResponseResult.databaseSuccess(data = toolBaseService.getList()) + /** * Add tool base diff --git a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/EditController.kt b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/EditController.kt index 6a40175..41aaed9 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/EditController.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/EditController.kt @@ -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> = - ResponseResult.databaseSuccess(data = editService.getTemplate()) + fun getTemplate(platform: ToolBase.Platform): ResponseResult> = + 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 = 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) ) /** diff --git a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/TemplateController.kt b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/TemplateController.kt index b65815c..3cbed35 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/TemplateController.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/controller/tool/TemplateController.kt @@ -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> = - ResponseResult.databaseSuccess(data = toolTemplateService.get()) + fun get(toolTemplateGetParam: ToolTemplateGetParam?): ResponseResult> = + ResponseResult.databaseSuccess(data = toolTemplateService.get(toolTemplateGetParam)) /** * Add tool template diff --git a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt index 1877c39..d37c56f 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt @@ -1,6 +1,8 @@ package top.fatweb.oxygen.api.converter.tool +import com.baomidou.mybatisplus.core.metadata.IPage import top.fatweb.oxygen.api.entity.tool.ToolBase +import top.fatweb.oxygen.api.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolBaseVo import top.fatweb.oxygen.api.vo.tool.ToolDataVo @@ -26,13 +28,14 @@ object ToolBaseConverter { name = toolBase.name, source = toolBase.source?.let(ToolDataConverter::toolDataToToolDataVo), dist = toolBase.dist?.let(ToolDataConverter::toolDataToToolDataVo), + platform = toolBase.platform, compiled = toolBase.compiled == 1, createTime = toolBase.createTime, updateTime = toolBase.updateTime ) /** - * Convert ToolBase object into ToolBaseVo object by get list + * Convert ToolBase object into ToolBaseVo object by get page * * @param toolBase ToolBase object * @return ToolBaseVo object @@ -46,8 +49,29 @@ object ToolBaseConverter { name = toolBase.name, source = ToolDataVo(id = toolBase.sourceId, data = null, createTime = null, updateTime = null), dist = ToolDataVo(id = toolBase.distId, data = null, createTime = null, updateTime = null), + platform = toolBase.platform, compiled = toolBase.compiled == 1, createTime = toolBase.createTime, updateTime = toolBase.updateTime ) + + /** + * Convert IPage object into PageVo object + * + * @param toolBasePage IPage object + * @return PageVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see IPage + * @see ToolBase + * @see PageVo + * @see ToolBaseVo + */ + fun toolBasePageToToolBasePageVo(toolBasePage: IPage) = PageVo( + total = toolBasePage.total, + pages = toolBasePage.pages, + size = toolBasePage.size, + current = toolBasePage.current, + records = toolBasePage.records.map(::toolBaseToToolBaseVoByGetList) + ) } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolConverter.kt b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolConverter.kt index b07c8bc..1402af2 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolConverter.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolConverter.kt @@ -28,6 +28,7 @@ object ToolConverter { name = tool.name, toolId = tool.toolId, icon = tool.icon, + platform = tool.platform, description = tool.description, base = tool.base?.let(ToolBaseConverter::toolBaseToToolBaseVo), author = tool.author?.let(UserConverter::userToUserWithInfoVo), diff --git a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolTemplateConverter.kt b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolTemplateConverter.kt index e3243ce..ccb8233 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolTemplateConverter.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolTemplateConverter.kt @@ -1,6 +1,8 @@ package top.fatweb.oxygen.api.converter.tool +import com.baomidou.mybatisplus.core.metadata.IPage import top.fatweb.oxygen.api.entity.tool.ToolTemplate +import top.fatweb.oxygen.api.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolBaseVo import top.fatweb.oxygen.api.vo.tool.ToolDataVo import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo @@ -27,12 +29,27 @@ object ToolTemplateConverter { name = toolTemplate.name, base = toolTemplate.base?.let(ToolBaseConverter::toolBaseToToolBaseVo), source = toolTemplate.source?.let(ToolDataConverter::toolDataToToolDataVo), + platform = toolTemplate.platform, entryPoint = toolTemplate.entryPoint, enable = toolTemplate.enable == 1, createTime = toolTemplate.createTime, updateTime = toolTemplate.updateTime ) + /** + * Convert IPage object into PageVo object + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + fun toolTemplatePageToToolTemplatePageVo(toolTemplatePage: IPage) = PageVo( + total = toolTemplatePage.total, + pages = toolTemplatePage.pages, + size = toolTemplatePage.size, + current = toolTemplatePage.current, + records = toolTemplatePage.records.map(::toolTemplateToToolTemplateVo) + ) + /** * Convert ToolTemplate object into ToolTemplateVo object by list * @@ -47,11 +64,13 @@ object ToolTemplateConverter { name = null, source = null, dist = null, + platform = toolTemplate.base?.platform, compiled = null, createTime = null, updateTime = null ), source = ToolDataVo(id = toolTemplate.sourceId, data = null, createTime = null, updateTime = null), + platform = toolTemplate.platform, entryPoint = toolTemplate.entryPoint, enable = toolTemplate.enable == 1, createTime = toolTemplate.createTime, @@ -72,11 +91,13 @@ object ToolTemplateConverter { name = toolTemplate.base?.name, source = null, dist = ToolDataVo(id = null, data = toolTemplate.base?.distData, createTime = null, updateTime = null), + platform = toolTemplate.base?.platform, compiled = null, createTime = null, updateTime = null ), source = toolTemplate.source?.let(ToolDataConverter::toolDataToToolDataVo), + platform = toolTemplate.platform, entryPoint = toolTemplate.entryPoint, enable = toolTemplate.enable == 1, createTime = toolTemplate.createTime, diff --git a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/Tool.kt b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/Tool.kt index a06d660..6788c81 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/Tool.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/Tool.kt @@ -60,6 +60,16 @@ class Tool { @TableField("icon") var icon: String? = null + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @TableField("platform") + var platform: ToolBase.Platform? = null + /** * Description * @@ -237,6 +247,6 @@ class Tool { var dist: ToolData? = null override fun toString(): String { - return "Tool(id=$id, name=$name, toolId=$toolId, icon=$icon, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, base=$base, categories=$categories, source=$source, dist=$dist)" + return "Tool(id=$id, name=$name, toolId=$toolId, icon=$icon, platform=$platform, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, base=$base, categories=$categories, source=$source, dist=$dist)" } } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt index 9878b57..9de0aa0 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt @@ -1,6 +1,7 @@ package top.fatweb.oxygen.api.entity.tool import com.baomidou.mybatisplus.annotation.* +import com.fasterxml.jackson.annotation.JsonValue import java.time.LocalDateTime /** @@ -11,6 +12,16 @@ import java.time.LocalDateTime */ @TableName("t_b_tool_base") class ToolBase { + /** + * 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 * @@ -47,6 +58,16 @@ class ToolBase { @TableField("dist_id") var distId: Long? = null + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Platform + */ + @TableField("platform") + var platform: Platform? = null + /** * Has compiled * @@ -124,6 +145,6 @@ class ToolBase { var distData: String? = null override fun toString(): String { - return "ToolBase(id=$id, name=$name, sourceId=$sourceId, distId=$distId, compiled=$compiled, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, dist=$dist, distData=$distData)" + return "ToolBase(id=$id, name=$name, sourceId=$sourceId, distId=$distId, platform=$platform, compiled=$compiled, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, dist=$dist, distData=$distData)" } } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolTemplate.kt b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolTemplate.kt index 124995b..09e8bde 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolTemplate.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolTemplate.kt @@ -47,6 +47,16 @@ class ToolTemplate { @TableField("source_id") var sourceId: Long? = null + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @TableField("platform") + var platform: ToolBase.Platform? = null + /** * Entry point * @@ -124,6 +134,6 @@ class ToolTemplate { var base: ToolBase? = null override fun toString(): String { - return "ToolTemplate(id=$id, name=$name, baseId=$baseId, sourceId=$sourceId, entryPoint=$entryPoint, enable=$enable, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, base=$base)" + return "ToolTemplate(id=$id, name=$name, baseId=$baseId, sourceId=$sourceId, platform=$platform, entryPoint=$entryPoint, enable=$enable, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, base=$base)" } } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/EditMapper.kt b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/EditMapper.kt index 3cfca8b..f874483 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/EditMapper.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/EditMapper.kt @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper import org.apache.ibatis.annotations.Mapper import org.apache.ibatis.annotations.Param import top.fatweb.oxygen.api.entity.tool.Tool +import top.fatweb.oxygen.api.entity.tool.ToolBase import top.fatweb.oxygen.api.entity.tool.ToolTemplate /** @@ -66,6 +67,7 @@ interface EditMapper : BaseMapper { @Param("username") username: String, @Param("toolId") toolId: String, @Param("ver") ver: String, + @Param("platform") platform: ToolBase.Platform, @Param("operator") operator: String? ): List? } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ManagementMapper.kt b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ManagementMapper.kt index 8ef9eb7..0ef1619 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ManagementMapper.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ManagementMapper.kt @@ -43,6 +43,7 @@ interface ManagementMapper : BaseMapper { fun selectPage( page: IPage, @Param("review") review: List?, + @Param("platform") platform: List?, @Param("searchType") searchType: String, @Param("searchValue") searchValue: String?, @Param("searchRegex") searchRegex: Boolean diff --git a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ToolTemplateMapper.kt b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ToolTemplateMapper.kt index e50c009..d009b4c 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ToolTemplateMapper.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/ToolTemplateMapper.kt @@ -1,6 +1,7 @@ package top.fatweb.oxygen.api.mapper.tool 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.ToolTemplate @@ -34,5 +35,8 @@ interface ToolTemplateMapper : BaseMapper { * @since 1.0.0 * @see ToolTemplate */ - fun selectList(): List + fun selectListWithBaseName( + page: IPage, + @Param("platform") platform: List? + ): IPage } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserAddParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserAddParam.kt index 7ccf586..98e19b9 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserAddParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserAddParam.kt @@ -110,8 +110,8 @@ data class UserAddParam( */ @Trim @Schema(description = "邮箱", required = true, example = "user@email.com") - @NotBlank(message = "Email can not be blank") - @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") + @field:NotBlank(message = "Email can not be blank") + @field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") var email: String?, /** diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserUpdateParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserUpdateParam.kt index d26a479..eab624a 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserUpdateParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/permission/user/UserUpdateParam.kt @@ -112,8 +112,8 @@ data class UserUpdateParam( */ @Trim @Schema(description = "邮箱", required = true, example = "user@email.com") - @NotBlank(message = "Email can not be blank") - @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") + @field:NotBlank(message = "Email can not be blank") + @field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") var email: String?, /** diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseAddParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseAddParam.kt index d62e4df..9a3bef3 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseAddParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseAddParam.kt @@ -2,7 +2,9 @@ package top.fatweb.oxygen.api.param.tool 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 /** * Add tool base parameters @@ -21,5 +23,16 @@ data class ToolBaseAddParam( @Trim @Schema(description = "名称", required = true) @field: NotBlank(message = "Name can not be blank") - var name: String? + var name: String?, + + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @Schema(description = "平台") + @field:NotNull(message = "Platform can not be null") + val platform: ToolBase.Platform? ) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseGetParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseGetParam.kt new file mode 100644 index 0000000..4f51c57 --- /dev/null +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolBaseGetParam.kt @@ -0,0 +1,27 @@ +package top.fatweb.oxygen.api.param.tool + +import io.swagger.v3.oas.annotations.media.Schema +import top.fatweb.oxygen.api.param.PageSortParam + +/** + * Get tool base parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see PageSortParam + */ +@Schema(description = "获取工具基板请求参数") +data class ToolBaseGetParam( + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema( + description = "平台过滤(多个使用逗号分隔)", + allowableValues = ["WEB", "DESKTOP", "ANDROID"], + example = "WEB" + ) + val platform: String? +) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolManagementGetParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolManagementGetParam.kt index 52973ce..4d98e5b 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolManagementGetParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolManagementGetParam.kt @@ -62,5 +62,18 @@ data class ToolManagementGetParam( allowableValues = ["NONE", "PROCESSING", "REJECT", "PASS"], example = "NONE,PASS" ) - val review: String? + val review: String?, + + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema( + description = "平台过滤(多个使用逗号分隔)", + allowableValues = ["WEB", "DESKTOP", "ANDROID"], + example = "WEB" + ) + val platform: String? ) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateGetParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateGetParam.kt new file mode 100644 index 0000000..79e2485 --- /dev/null +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateGetParam.kt @@ -0,0 +1,27 @@ +package top.fatweb.oxygen.api.param.tool + +import io.swagger.v3.oas.annotations.media.Schema +import top.fatweb.oxygen.api.param.PageSortParam + +/** + * Get tool template parameters + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see PageSortParam + */ +@Schema(description = "获取工具模板请求参数") +data class ToolTemplateGetParam( + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + */ + @Schema( + description = "平台过滤(多个使用逗号分隔)", + allowableValues = ["WEB", "DESKTOP", "ANDROID"], + example = "WEB" + ) + val platform: String? +) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateUpdateParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateUpdateParam.kt index 4d2c157..14ea57a 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateUpdateParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolTemplateUpdateParam.kt @@ -32,15 +32,6 @@ data class ToolTemplateUpdateParam( @Schema(description = "名称") var name: String?, - /** - * Base ID - * - * @author FatttSnake, fatttsnake@gmail.com - * @since 1.0.0 - */ - @Schema(description = "Base ID") - val baseId: Long?, - /** * Source * diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolUpgradeParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolUpgradeParam.kt index d4e20d4..321c1ff 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolUpgradeParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolUpgradeParam.kt @@ -2,8 +2,10 @@ package top.fatweb.oxygen.api.param.tool import io.swagger.v3.oas.annotations.media.Schema 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 /** * Upgrade tool parameters @@ -29,6 +31,18 @@ data class ToolUpgradeParam( ) var toolId: String?, + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @Schema(description = "平台") + @field:NotNull(message = "Platform can not be null") + val platform: ToolBase.Platform?, + + /** * Version * diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IEditService.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IEditService.kt index 3a92b4a..0c41807 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IEditService.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IEditService.kt @@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.service.tool import com.baomidou.mybatisplus.extension.service.IService import top.fatweb.oxygen.api.entity.tool.Tool +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 @@ -19,14 +20,15 @@ import top.fatweb.oxygen.api.vo.tool.ToolVo */ interface IEditService : IService { /** - * Get tool template as list + * Get tool template as list by platform * * @return List of ToolTemplateVo object * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ToolBase.Platform * @see ToolTemplateVo */ - fun getTemplate(): List + fun getTemplate(platform: ToolBase.Platform): List /** * Get tool template by ID @@ -111,12 +113,14 @@ interface IEditService : IService { * @param username Username * @param toolId Tool ID * @param ver Version + * @param platform Platform * @return ToolVo object * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ToolBase.Platform * @see ToolVo */ - fun detail(username: String, toolId: String, ver: String): ToolVo + fun detail(username: String, toolId: String, ver: String, platform: ToolBase.Platform): ToolVo /** * Submit tool review diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolBaseService.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolBaseService.kt index 5bd0966..9a769a5 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolBaseService.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolBaseService.kt @@ -3,7 +3,9 @@ package top.fatweb.oxygen.api.service.tool import com.baomidou.mybatisplus.extension.service.IService import top.fatweb.oxygen.api.entity.tool.ToolBase 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.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolBaseVo /** @@ -27,14 +29,27 @@ interface IToolBaseService : IService { fun getOne(id: Long): ToolBaseVo /** - * Get tool base in list + * Get tool base in page + * + * @param toolBaseGetParam Get tool base parameters + * @return PageVo object + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBaseGetParam + * @see PageVo + * @see ToolBaseVo + */ + fun get(toolBaseGetParam: ToolBaseGetParam?): PageVo + + /** + * Get all tool base in list * * @return List of ToolBaseVo object * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 * @see ToolBaseVo */ - fun get(): List + fun getList(): List /** * Add tool base diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolTemplateService.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolTemplateService.kt index 1cb3d54..be6d60e 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolTemplateService.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/IToolTemplateService.kt @@ -3,7 +3,9 @@ package top.fatweb.oxygen.api.service.tool import com.baomidou.mybatisplus.extension.service.IService import top.fatweb.oxygen.api.entity.tool.ToolTemplate 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.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo /** @@ -27,14 +29,16 @@ interface IToolTemplateService : IService { fun getOne(id: Long): ToolTemplateVo /** - * Get tool template in list + * Get tool template in page * - * @return List of ToolTemplateVo object + * @return Page of ToolTemplateVo object * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 + * @see ToolTemplateGetParam + * @see PageVo * @see ToolTemplateVo */ - fun get(): List + fun get(toolTemplateGetParam: ToolTemplateGetParam?): PageVo /** * Add tool template diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/EditServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/EditServiceImpl.kt index ab8268c..3956347 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/EditServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/EditServiceImpl.kt @@ -38,9 +38,12 @@ class EditServiceImpl( private val toolDataService: IToolDataService, private val rToolCategoryService: IRToolCategoryService ) : ServiceImpl(), IEditService { - override fun getTemplate(): List = - toolTemplateService.list(KtQueryWrapper(ToolTemplate()).eq(ToolTemplate::enable, 1)) - .map(ToolTemplateConverter::toolTemplateToToolTemplateVoByList) + override fun getTemplate(platform: ToolBase.Platform): List = + toolTemplateService.list( + KtQueryWrapper(ToolTemplate()) + .eq(ToolTemplate::platform, platform) + .eq(ToolTemplate::enable, 1) + ).map(ToolTemplateConverter::toolTemplateToToolTemplateVoByList) override fun getTemplate(id: Long): ToolTemplateVo = baseMapper.selectTemplate(id)?.let(ToolTemplateConverter::toolTemplateToToolTemplateVoWithBaseDist) @@ -56,11 +59,15 @@ class EditServiceImpl( @Transactional override fun create(toolCreateParam: ToolCreateParam): ToolVo { - baseMapper.selectOne( - KtQueryWrapper(Tool()).eq(Tool::toolId, toolCreateParam.toolId!!) - .eq(Tool::authorId, WebUtil.getLoginUserId()!!) - )?.let { throw DuplicateKeyException("Duplicate Key") } val template = this.getTemplate(toolCreateParam.templateId!!) + baseMapper.selectOne( + KtQueryWrapper(Tool()) + .eq(Tool::toolId, toolCreateParam.toolId!!) + .eq(Tool::authorId, WebUtil.getLoginUserId()!!) + .eq(Tool::platform, template.platform) + )?.let { + throw DuplicateKeyException("Duplicate Key") + } val newSource = ToolData().apply { data = template.source!!.data } val newDist = ToolData().apply { data = "" } toolDataService.saveBatch(listOf(newSource, newDist)) @@ -69,6 +76,7 @@ class EditServiceImpl( name = toolCreateParam.name!!.trim() toolId = toolCreateParam.toolId icon = toolCreateParam.icon + platform = template.platform description = toolCreateParam.description baseId = template.base!!.id authorId = WebUtil.getLoginUserId()!! @@ -94,7 +102,7 @@ class EditServiceImpl( @Transactional override fun upgrade(toolUpgradeParam: ToolUpgradeParam): ToolVo { - val originalTool = this.detail("!", toolUpgradeParam.toolId!!, "latest") + val originalTool = this.detail("!", toolUpgradeParam.toolId!!, "latest", toolUpgradeParam.platform!!) if (originalTool.review == Tool.ReviewType.PROCESSING) { throw ToolUnderReviewException() } @@ -206,11 +214,11 @@ class EditServiceImpl( baseMapper.selectPersonal(WebUtil.getLoginUserId()!!) .map(ToolConverter::toolToToolVo) - override fun detail(username: String, toolId: String, ver: String): ToolVo { + override fun detail(username: String, toolId: String, ver: String, platform: ToolBase.Platform): ToolVo { if (username == "!" && WebUtil.getLoginUserId() == null) { throw NoRecordFoundException() } - val toolList = baseMapper.selectDetail(username, toolId, ver, WebUtil.getLoginUsername()) + val toolList = baseMapper.selectDetail(username, toolId, ver, platform, WebUtil.getLoginUsername()) if (toolList.isNullOrEmpty()) { throw NoRecordFoundException() } diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ManagementServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ManagementServiceImpl.kt index 19309bc..96ac255 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ManagementServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ManagementServiceImpl.kt @@ -1,6 +1,5 @@ package top.fatweb.oxygen.api.service.tool.impl -import com.baomidou.mybatisplus.core.metadata.OrderItem import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper import com.baomidou.mybatisplus.extension.plugins.pagination.Page @@ -20,7 +19,6 @@ import top.fatweb.oxygen.api.param.tool.ToolManagementPassParam import top.fatweb.oxygen.api.service.tool.IManagementService import top.fatweb.oxygen.api.service.tool.IRToolCategoryService import top.fatweb.oxygen.api.service.tool.IToolDataService -import top.fatweb.oxygen.api.util.PageUtil import top.fatweb.oxygen.api.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolVo import java.time.LocalDateTime @@ -53,6 +51,7 @@ class ManagementServiceImpl( baseMapper.selectPage( toolIdsPage, toolManagementGetParam?.review?.split(","), + toolManagementGetParam?.platform?.split(","), toolManagementGetParam?.searchType ?: "ALL", toolManagementGetParam?.searchValue, toolManagementGetParam?.searchRegex ?: false diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt index e1070f9..fc2fb9d 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt @@ -1,5 +1,7 @@ package top.fatweb.oxygen.api.service.tool.impl +import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper +import com.baomidou.mybatisplus.extension.plugins.pagination.Page import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -9,9 +11,12 @@ import top.fatweb.oxygen.api.entity.tool.ToolData import top.fatweb.oxygen.api.exception.NoRecordFoundException import top.fatweb.oxygen.api.mapper.tool.ToolBaseMapper 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.service.tool.IToolDataService +import top.fatweb.oxygen.api.util.PageUtil +import top.fatweb.oxygen.api.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolBaseVo /** @@ -31,7 +36,24 @@ class ToolBaseServiceImpl( override fun getOne(id: Long): ToolBaseVo = baseMapper.selectOne(id)?.let(ToolBaseConverter::toolBaseToToolBaseVo) ?: throw NoRecordFoundException() - override fun get(): List = this.list().map(ToolBaseConverter::toolBaseToToolBaseVoByGetList) + override fun get(toolBaseGetParam: ToolBaseGetParam?): PageVo { + val basePage = Page(toolBaseGetParam?.currentPage ?: 1, toolBaseGetParam?.pageSize ?: 20) + + PageUtil.setPageSort(toolBaseGetParam, basePage) + + return ToolBaseConverter.toolBasePageToToolBasePageVo( + this.page( + basePage, + KtQueryWrapper(ToolBase()).`in`( + !toolBaseGetParam?.platform.isNullOrBlank(), + ToolBase::platform, + toolBaseGetParam?.platform?.split(",") + ) + ) + ) + } + + override fun getList(): List = this.list().map(ToolBaseConverter::toolBaseToToolBaseVoByGetList) @Transactional override fun add(toolBaseAddParam: ToolBaseAddParam): ToolBaseVo { @@ -46,6 +68,7 @@ class ToolBaseServiceImpl( distId = newDist.id source = newSource dist = newDist + platform = toolBaseAddParam.platform } this.save(toolBase) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolTemplateServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolTemplateServiceImpl.kt index ab9e16a..45ee0ae 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolTemplateServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolTemplateServiceImpl.kt @@ -1,5 +1,6 @@ package top.fatweb.oxygen.api.service.tool.impl +import com.baomidou.mybatisplus.extension.plugins.pagination.Page import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -9,10 +10,13 @@ import top.fatweb.oxygen.api.entity.tool.ToolTemplate import top.fatweb.oxygen.api.exception.NoRecordFoundException import top.fatweb.oxygen.api.mapper.tool.ToolTemplateMapper 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.IToolBaseService import top.fatweb.oxygen.api.service.tool.IToolDataService import top.fatweb.oxygen.api.service.tool.IToolTemplateService +import top.fatweb.oxygen.api.util.PageUtil +import top.fatweb.oxygen.api.vo.PageVo import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo /** @@ -34,12 +38,20 @@ class ToolTemplateServiceImpl( baseMapper.selectOne(id)?.let(ToolTemplateConverter::toolTemplateToToolTemplateVo) ?: throw NoRecordFoundException() - override fun get(): List = - baseMapper.selectList().map(ToolTemplateConverter::toolTemplateToToolTemplateVo) + override fun get(toolTemplateGetParam: ToolTemplateGetParam?): PageVo { + val templatePage = + Page(toolTemplateGetParam?.currentPage ?: 1, toolTemplateGetParam?.pageSize ?: 20) + + PageUtil.setPageSort(toolTemplateGetParam, templatePage) + + return ToolTemplateConverter.toolTemplatePageToToolTemplatePageVo( + baseMapper.selectListWithBaseName(templatePage, toolTemplateGetParam?.platform?.split(",")) + ) + } @Transactional override fun add(toolTemplateAddParam: ToolTemplateAddParam): ToolTemplateVo { - toolBaseService.getOne(toolTemplateAddParam.baseId!!) + val toolBase = toolBaseService.getOne(toolTemplateAddParam.baseId!!) val newSource = ToolData().apply { data = "" } @@ -50,6 +62,7 @@ class ToolTemplateServiceImpl( baseId = toolTemplateAddParam.baseId sourceId = newSource.id source = newSource + platform = toolBase.platform entryPoint = toolTemplateAddParam.entryPoint enable = if (toolTemplateAddParam.enable) 1 else 0 } @@ -62,7 +75,6 @@ class ToolTemplateServiceImpl( @Transactional override fun update(toolTemplateUpdateParam: ToolTemplateUpdateParam): ToolTemplateVo { val toolTemplate = baseMapper.selectOne(toolTemplateUpdateParam.id!!) ?: throw NoRecordFoundException() - toolTemplateUpdateParam.baseId?.let(toolBaseService::getOne) toolDataService.updateById(ToolData().apply { id = toolTemplate.sourceId @@ -72,7 +84,6 @@ class ToolTemplateServiceImpl( this.updateById(ToolTemplate().apply { id = toolTemplateUpdateParam.id name = toolTemplateUpdateParam.name - baseId = toolTemplateUpdateParam.baseId entryPoint = toolTemplateUpdateParam.entryPoint enable = toolTemplateUpdateParam.enable?.let { if (it) 1 else 0 } }) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt index 0704766..25278c1 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt @@ -3,6 +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 java.time.LocalDateTime /** @@ -49,6 +50,16 @@ data class ToolBaseVo( @Schema(description = "产物") val dist: ToolDataVo?, + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @Schema(description = "平台") + val platform: ToolBase.Platform?, + /** * Compiled * diff --git a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolTemplateVo.kt b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolTemplateVo.kt index fea3b1f..cad88bb 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolTemplateVo.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolTemplateVo.kt @@ -3,6 +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 java.time.LocalDateTime /** @@ -49,6 +50,16 @@ data class ToolTemplateVo( @Schema(description = "源码") val source: ToolDataVo?, + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @Schema(description = "平台") + val platform: ToolBase.Platform?, + /** * Entry point * diff --git a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt index 5a32d44..6cce238 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt @@ -4,6 +4,7 @@ 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.Tool +import top.fatweb.oxygen.api.entity.tool.ToolBase import top.fatweb.oxygen.api.vo.permission.UserWithInfoVo import java.time.LocalDateTime @@ -50,6 +51,16 @@ data class ToolVo( @Schema(description = "图标") val icon: String?, + /** + * Platform + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see ToolBase.Platform + */ + @Schema(description = "平台") + val platform: ToolBase.Platform?, + /** * Description * diff --git a/src/main/resources/application-config-template.yml b/src/main/resources/application-config-template.yml index 6747dbc..d42e842 100644 --- a/src/main/resources/application-config-template.yml +++ b/src/main/resources/application-config-template.yml @@ -62,5 +62,8 @@ logging: # max-file-size: 10MB # Maximum log file size # max-history: 7 # Maximum number of archive log files to keep +mybatis-plus: + type-aliases-package: top.fatweb.oxygen.api.entity + knife4j: production: true # Production environment mode will block doc \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240115__Add_table_'t_b_tool_main'.sql b/src/main/resources/db/migration/master/V1_0_0_240115__Add_table_'t_b_tool_main'.sql index 1b396f2..4f07c84 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240115__Add_table_'t_b_tool_main'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240115__Add_table_'t_b_tool_main'.sql @@ -6,6 +6,7 @@ create table if not exists t_b_tool_main name varchar(50) not null comment '工具名', tool_id varchar(50) not null comment '工具 ID', icon text not null comment '图标', + platform varchar(20) not null comment '平台', description varchar(500) null comment '简介', base_id bigint not null comment '基板 ID', author_id bigint not null comment '作者 ID', @@ -20,6 +21,6 @@ create table if not exists t_b_tool_main update_time datetime not null default (utc_timestamp()) comment '修改时间', deleted bigint not null default 0, version int not null default 0, - constraint t_b_tool_main_unique_tool_id_ver unique (tool_id, author_id, ver, deleted), - constraint t_b_tool_main_unique_tool_id_publish unique (tool_id, author_id, publish, deleted) + constraint t_b_tool_main_unique_tool_id_platform_author_ver unique (tool_id, platform, author_id, ver, deleted), + constraint t_b_tool_main_unique_tool_id_platform_author_publish unique (tool_id, platform, author_id, publish, deleted) ) comment '工具-主表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql b/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql index 0d442a9..899b171 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql @@ -6,11 +6,12 @@ create table if not exists t_b_tool_template name varchar(40) not null comment '模板名', base_id bigint not null comment '基板 ID', source_id bigint not null comment '源码 ID', + platform varchar(20) not null comment '平台', entry_point varchar(64) not null default 'main.tsx' comment '入口文件', enable int not null default 1 comment '启用', create_time datetime not null default (utc_timestamp()) comment '创建时间', update_time datetime not null default (utc_timestamp()) comment '修改时间', deleted bigint not null default 0, version int not null default 0, - constraint t_b_tool_template_unique_name unique (name, deleted) + constraint t_b_tool_template_unique_name_platform unique (name, platform, deleted) ) comment '工具-模板表' \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql index 9225778..8531682 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql @@ -6,10 +6,11 @@ create table if not exists t_b_tool_base name varchar(20) not null comment '基板名', source_id bigint not null comment '源码 ID', dist_id bigint not null comment '产物 ID', + platform varchar(20) not null comment '平台', compiled int not null default 0 comment '已编译', create_time datetime not null default (utc_timestamp()) comment '创建时间', update_time datetime not null default (utc_timestamp()) comment '修改时间', deleted bigint not null default 0, version int not null default 0, - constraint t_b_tool_base_unique_name unique (name, deleted) + constraint t_b_tool_base_unique_name_platform unique (name, platform, deleted) ) \ No newline at end of file diff --git a/src/main/resources/mapper/tool/EditMapper.xml b/src/main/resources/mapper/tool/EditMapper.xml index 9f7aeb4..ca46957 100644 --- a/src/main/resources/mapper/tool/EditMapper.xml +++ b/src/main/resources/mapper/tool/EditMapper.xml @@ -6,6 +6,7 @@ t_b_tool_template.name as tool_template_name, t_b_tool_template.base_id as tool_template_base_id, t_b_tool_template.source_id as tool_template_source_id, + t_b_tool_template.platform as tool_template_platform, t_b_tool_template.entry_point as tool_template_entry_point, t_b_tool_template.enable as tool_template_enable, t_b_tool_template.create_time as tool_template_create_time, @@ -35,6 +36,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, @@ -97,6 +99,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, @@ -133,6 +136,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, @@ -187,6 +191,7 @@ and t_b_tool_main.deleted = 0 and t_b_tool_main.tool_id = #{toolId} + and t_b_tool_main.platform = #{platform} and tsu.username = #{username} diff --git a/src/main/resources/mapper/tool/ManagementMapper.xml b/src/main/resources/mapper/tool/ManagementMapper.xml index 1debeda..b2e6e71 100644 --- a/src/main/resources/mapper/tool/ManagementMapper.xml +++ b/src/main/resources/mapper/tool/ManagementMapper.xml @@ -6,6 +6,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, @@ -74,6 +75,11 @@ close=")" nullable="true"> #{item} + + #{item} + @@ -155,6 +161,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, @@ -216,6 +223,7 @@ + diff --git a/src/main/resources/mapper/tool/StoreMapper.xml b/src/main/resources/mapper/tool/StoreMapper.xml index 1eefde7..ef002f7 100644 --- a/src/main/resources/mapper/tool/StoreMapper.xml +++ b/src/main/resources/mapper/tool/StoreMapper.xml @@ -60,6 +60,7 @@ t_b_tool_main.name as tool_name, t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.icon as tool_icon, + t_b_tool_main.platform as tool_platform, t_b_tool_main.description as tool_description, t_b_tool_main.base_id as tool_base_id, t_b_tool_main.author_id as tool_author_id, diff --git a/src/main/resources/mapper/tool/ToolBaseMapper.xml b/src/main/resources/mapper/tool/ToolBaseMapper.xml index 2994493..8378225 100644 --- a/src/main/resources/mapper/tool/ToolBaseMapper.xml +++ b/src/main/resources/mapper/tool/ToolBaseMapper.xml @@ -6,6 +6,7 @@ t_b_tool_base.name as tool_base_name, t_b_tool_base.source_id as tool_base_source_id, t_b_tool_base.dist_id as tool_base_dist_id, + t_b_tool_base.platform as tool_base_platform, t_b_tool_base.compiled as tool_base_compiled, t_b_tool_base.create_time as tool_base_create_time, t_b_tool_base.update_time as tool_base_update_time, @@ -34,6 +35,7 @@ + diff --git a/src/main/resources/mapper/tool/ToolTemplateMapper.xml b/src/main/resources/mapper/tool/ToolTemplateMapper.xml index b25a8eb..f22c254 100644 --- a/src/main/resources/mapper/tool/ToolTemplateMapper.xml +++ b/src/main/resources/mapper/tool/ToolTemplateMapper.xml @@ -6,6 +6,7 @@ t_b_tool_template.name as tool_template_name, t_b_tool_template.base_id as tool_template_base_id, t_b_tool_template.source_id as tool_template_source_id, + t_b_tool_template.platform as tool_template_platform, t_b_tool_template.entry_point as tool_template_entry_point, t_b_tool_template.enable as tool_template_enable, t_b_tool_template.create_time as tool_template_create_time, @@ -27,22 +28,29 @@ and t_b_tool_template.id = #{id} - + select t_b_tool_template.id as tool_template_id, + t_b_tool_template.name as tool_template_name, + t_b_tool_template.base_id as tool_template_base_id, + t_b_tool_template.source_id as tool_template_source_id, + t_b_tool_template.platform as tool_template_platform, + t_b_tool_template.entry_point as tool_template_entry_point, + t_b_tool_template.enable as tool_template_enable, + t_b_tool_template.create_time as tool_template_create_time, + t_b_tool_template.update_time as tool_template_update_time, + t_b_tool_template.deleted as tool_template_deleted, + t_b_tool_template.version as tool_template_version, + tbtb.name as tool_template_base_name from t_b_tool_template - left join (select * from t_b_tool_base where deleted = 0) as tbtb - on tbtb.id = t_b_tool_template.base_id - where t_b_tool_template.deleted = 0 + left join (select * from t_b_tool_base where deleted = 0) as tbtb + on tbtb.id = t_b_tool_template.base_id + + and t_b_tool_template.deleted = 0 + + #{item} + + @@ -50,6 +58,7 @@ + -- 2.49.1