Fix(EditService): Fix get wrong tool detail

Fix get wrong tool detail in source page
This commit is contained in:
2024-04-26 16:31:44 +08:00
parent eeb3c0a687
commit bdd0197d78
3 changed files with 6 additions and 6 deletions

View File

@@ -69,5 +69,5 @@ interface EditMapper : BaseMapper<Tool> {
@Param("ver") ver: String, @Param("ver") ver: String,
@Param("platform") platform: ToolBase.Platform, @Param("platform") platform: ToolBase.Platform,
@Param("operator") operator: String? @Param("operator") operator: String?
): List<Tool>? ): Tool?
} }

View File

@@ -219,12 +219,9 @@ class EditServiceImpl(
if (username == "!" && WebUtil.getLoginUserId() == null) { if (username == "!" && WebUtil.getLoginUserId() == null) {
throw NoRecordFoundException() throw NoRecordFoundException()
} }
val toolList = baseMapper.selectDetail(username, toolId, ver, platform, WebUtil.getLoginUsername())
if (toolList.isNullOrEmpty()) {
throw NoRecordFoundException()
}
return toolList.first().let(ToolConverter::toolToToolVo) return baseMapper.selectDetail(username, toolId, ver, platform, WebUtil.getLoginUsername())
?.let(ToolConverter::toolToToolVo) ?: throw NoRecordFoundException()
} }
override fun submit(id: Long): Boolean { override fun submit(id: Long): Boolean {

View File

@@ -195,6 +195,7 @@
<choose> <choose>
<when test="operator == null"> <when test="operator == null">
and tsu.username = #{username} and tsu.username = #{username}
and t_b_tool_main.publish != 0
</when> </when>
<otherwise> <otherwise>
<choose> <choose>
@@ -206,11 +207,13 @@
</when> </when>
<otherwise> <otherwise>
and tsu.username = #{username} and tsu.username = #{username}
and t_b_tool_main.publish != 0
</otherwise> </otherwise>
</choose> </choose>
</otherwise> </otherwise>
</choose> </choose>
</where> </where>
order by t_b_tool_main.id desc order by t_b_tool_main.id desc
limit 1
</select> </select>
</mapper> </mapper>