From b7f0222e367ac7a00168fa93bd9f4e5b245a4843 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 10 May 2024 05:13:35 +0800 Subject: [PATCH] Feat(Store): Support specify platform to search tools --- .../fatweb/oxygen/api/mapper/tool/StoreMapper.kt | 7 ++++++- .../oxygen/api/param/tool/ToolStoreGetParam.kt | 13 ++++++++++++- .../api/service/tool/impl/StoreServiceImpl.kt | 3 ++- src/main/resources/mapper/tool/StoreMapper.xml | 3 +++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/StoreMapper.kt b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/StoreMapper.kt index 7efdf91..c51d574 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/StoreMapper.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/mapper/tool/StoreMapper.kt @@ -4,6 +4,7 @@ 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 /** @@ -26,7 +27,11 @@ interface StoreMapper : BaseMapper { * @since 1.0.0 * @see IPage */ - fun selectAuthorToolIdPage(page: IPage, @Param("searchValue") searchValue: String?): IPage + fun selectAuthorToolIdPage( + page: IPage, + @Param("searchValue") searchValue: String?, + @Param("platform") platform: Platform + ): IPage /** * Select author and tool ID by username in page diff --git a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolStoreGetParam.kt b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolStoreGetParam.kt index f127bcb..413a893 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolStoreGetParam.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/param/tool/ToolStoreGetParam.kt @@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool import io.swagger.v3.oas.annotations.media.Schema import top.fatweb.oxygen.api.annotation.Trim +import top.fatweb.oxygen.api.entity.tool.Platform import top.fatweb.oxygen.api.param.PageSortParam /** @@ -21,5 +22,15 @@ data class ToolStoreGetParam( */ @Trim @Schema(description = "查询内容", example = "ToolName") - var searchValue: String? + var searchValue: String?, + + /** + * Platform to search for + * + * @author FatttSnake, fatttsnake@gmail.com + * @since 1.0.0 + * @see Platform + */ + @Schema(description = "指定平台", example = "DESKTOP") + val platform: Platform ) : PageSortParam() diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/StoreServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/StoreServiceImpl.kt index 18fb21a..18db2eb 100644 --- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/StoreServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/StoreServiceImpl.kt @@ -39,7 +39,8 @@ class StoreServiceImpl( val toolIdsPage = Page(toolStoreGetParam.currentPage, 20) toolIdsPage.setOptimizeCountSql(false) - val toolIdsIPage = baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue) + val toolIdsIPage = + baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue, toolStoreGetParam.platform) val toolPage = Page(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total) if (toolIdsIPage.total > 0) { toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId())) diff --git a/src/main/resources/mapper/tool/StoreMapper.xml b/src/main/resources/mapper/tool/StoreMapper.xml index ca63d96..c526555 100644 --- a/src/main/resources/mapper/tool/StoreMapper.xml +++ b/src/main/resources/mapper/tool/StoreMapper.xml @@ -20,6 +20,9 @@ or tk.keyword like concat('%', #{searchValue}, '%') ) + + and temp1.platform = #{platform} +