From 0c9de223fb64a9c0eacd97a66677d5c53a12e5a5 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Fri, 10 May 2024 05:33:23 +0800 Subject: [PATCH] Fix(Store): Fix specify platform to search tools --- .../top/fatweb/oxygen/api/mapper/tool/StoreMapper.kt | 12 ++++++------ .../oxygen/api/service/tool/impl/StoreServiceImpl.kt | 4 ++-- src/main/resources/mapper/tool/StoreMapper.xml | 6 +++--- 3 files changed, 11 insertions(+), 11 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 c51d574..8224526 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 @@ -27,11 +27,7 @@ interface StoreMapper : BaseMapper { * @since 1.0.0 * @see IPage */ - fun selectAuthorToolIdPage( - page: IPage, - @Param("searchValue") searchValue: String?, - @Param("platform") platform: Platform - ): IPage + fun selectAuthorToolIdPage(page: IPage, @Param("searchValue") searchValue: String?): IPage /** * Select author and tool ID by username in page @@ -54,7 +50,11 @@ interface StoreMapper : BaseMapper { * @since 1.0.0 * @see Tool */ - fun selectListByAuthorToolIds(@Param("ids") ids: List, @Param("operator") operator: Long?): List + fun selectListByAuthorToolIds( + @Param("ids") ids: List, + @Param("operator") operator: Long?, + @Param("platform") platform: Platform? = null + ): List /** * Count published tool by username and toolId 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 18db2eb..809fe1d 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 @@ -40,10 +40,10 @@ class StoreServiceImpl( toolIdsPage.setOptimizeCountSql(false) val toolIdsIPage = - baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue, toolStoreGetParam.platform) + baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue) val toolPage = Page(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total) if (toolIdsIPage.total > 0) { - toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId())) + toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId(), toolStoreGetParam.platform)) } return ToolConverter.toolPageToToolPageVo(toolPage) diff --git a/src/main/resources/mapper/tool/StoreMapper.xml b/src/main/resources/mapper/tool/StoreMapper.xml index c526555..dc71b72 100644 --- a/src/main/resources/mapper/tool/StoreMapper.xml +++ b/src/main/resources/mapper/tool/StoreMapper.xml @@ -20,9 +20,6 @@ or tk.keyword like concat('%', #{searchValue}, '%') ) - - and temp1.platform = #{platform} - @@ -110,6 +107,9 @@ on tbtf.user_id = #{operator} and tbtf.author_id = tbtm.author_id and tbtf.tool_id = tbtm.tool_id and tbtm.rn = 1 + + and tbtm.platform = #{platform} + #{item}