Feat(Store): Support specify platform to search tools
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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()))
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user