Refactor:1; Feat:1 #27

Merged
FatttSnake merged 2 commits from FatttSnake into dev 2024-05-10 05:15:18 +08:00
4 changed files with 23 additions and 3 deletions
Showing only changes of commit b7f0222e36 - Show all commits

View File

@@ -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<Tool> {
* @since 1.0.0
* @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

View File

@@ -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()

View File

@@ -39,7 +39,8 @@ class StoreServiceImpl(
val toolIdsPage = Page<Long>(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<Tool>(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total)
if (toolIdsIPage.total > 0) {
toolPage.setRecords(baseMapper.selectListByAuthorToolIds(toolIdsIPage.records, WebUtil.getLoginUserId()))

View File

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