Fix(Store): Fix specify platform to search tools #28

Merged
FatttSnake merged 1 commits from FatttSnake into dev 2024-05-10 05:33:55 +08:00
3 changed files with 11 additions and 11 deletions

View File

@@ -27,11 +27,7 @@ interface StoreMapper : BaseMapper<Tool> {
* @since 1.0.0 * @since 1.0.0
* @see IPage * @see IPage
*/ */
fun selectAuthorToolIdPage( fun selectAuthorToolIdPage(page: IPage<Long>, @Param("searchValue") searchValue: String?): IPage<String>
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
@@ -54,7 +50,11 @@ interface StoreMapper : BaseMapper<Tool> {
* @since 1.0.0 * @since 1.0.0
* @see Tool * @see Tool
*/ */
fun selectListByAuthorToolIds(@Param("ids") ids: List<String>, @Param("operator") operator: Long?): List<Tool> fun selectListByAuthorToolIds(
@Param("ids") ids: List<String>,
@Param("operator") operator: Long?,
@Param("platform") platform: Platform? = null
): List<Tool>
/** /**
* Count published tool by username and toolId * Count published tool by username and toolId

View File

@@ -40,10 +40,10 @@ class StoreServiceImpl(
toolIdsPage.setOptimizeCountSql(false) toolIdsPage.setOptimizeCountSql(false)
val toolIdsIPage = val toolIdsIPage =
baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue, toolStoreGetParam.platform) baseMapper.selectAuthorToolIdPage(toolIdsPage, toolStoreGetParam.searchValue)
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(), toolStoreGetParam.platform))
} }
return ToolConverter.toolPageToToolPageVo(toolPage) return ToolConverter.toolPageToToolPageVo(toolPage)

View File

@@ -20,9 +20,6 @@
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">
@@ -110,6 +107,9 @@
on tbtf.user_id = #{operator} and tbtf.author_id = tbtm.author_id and tbtf.tool_id = tbtm.tool_id on tbtf.user_id = #{operator} and tbtf.author_id = tbtm.author_id and tbtf.tool_id = tbtm.tool_id
<where> <where>
and tbtm.rn = 1 and tbtm.rn = 1
<if test="platform != null">
and tbtm.platform = #{platform}
</if>
<foreach collection="ids" item="item" index="index" open="and concat(tbtm.author_id, ':', tbtm.tool_id) in (" separator="," close=")" <foreach collection="ids" item="item" index="index" open="and concat(tbtm.author_id, ':', tbtm.tool_id) in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}