Feat(Store): Support specify platform to search tools

This commit is contained in:
2024-05-10 05:13:35 +08:00
parent 491e6cf1cd
commit b7f0222e36
4 changed files with 23 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.core.metadata.IPage import com.baomidou.mybatisplus.core.metadata.IPage
import org.apache.ibatis.annotations.Mapper import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param 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.Tool
/** /**
@@ -26,7 +27,11 @@ interface StoreMapper : BaseMapper<Tool> {
* @since 1.0.0 * @since 1.0.0
* @see IPage * @see IPage
*/ */
fun selectAuthorToolIdPage(page: IPage<Long>, @Param("searchValue") searchValue: String?): IPage<String> fun selectAuthorToolIdPage(
page: IPage<Long>,
@Param("searchValue") searchValue: String?,
@Param("platform") platform: Platform
): IPage<String>
/** /**
* Select author and tool ID by username in page * Select author and tool ID by username in page

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.tool.Platform
import top.fatweb.oxygen.api.param.PageSortParam import top.fatweb.oxygen.api.param.PageSortParam
/** /**
@@ -21,5 +22,15 @@ data class ToolStoreGetParam(
*/ */
@Trim @Trim
@Schema(description = "查询内容", example = "ToolName") @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() ) : PageSortParam()

View File

@@ -39,7 +39,8 @@ class StoreServiceImpl(
val toolIdsPage = Page<Long>(toolStoreGetParam.currentPage, 20) val toolIdsPage = Page<Long>(toolStoreGetParam.currentPage, 20)
toolIdsPage.setOptimizeCountSql(false) toolIdsPage.setOptimizeCountSql(false)
val toolIdsIPage = baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue) val toolIdsIPage =
baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue, toolStoreGetParam.platform)
val toolPage = Page<Tool>(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total) val toolPage = Page<Tool>(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total)
if (toolIdsIPage.total > 0) { if (toolIdsIPage.total > 0) {
toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId())) toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId()))

View File

@@ -20,6 +20,9 @@
or tk.keyword like concat('%', #{searchValue}, '%') or tk.keyword like concat('%', #{searchValue}, '%')
) )
</if> </if>
<if test="platform != null">
and temp1.platform = #{platform}
</if>
</where> </where>
<choose> <choose>
<when test="searchValue != null"> <when test="searchValue != null">