Refactor:1; Feat:1 #27
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user