Add kdoc
This commit is contained in:
@@ -12,6 +12,12 @@ import top.fatweb.oxygen.api.service.tool.IManagementService
|
||||
import top.fatweb.oxygen.api.vo.PageVo
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
/**
|
||||
* Tool management controller
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@BaseController(path = ["/system/tool"], name = "工具管理", description = "工具管理相关接口")
|
||||
class ManagementController(
|
||||
private val managementService: IManagementService
|
||||
|
||||
@@ -43,6 +43,18 @@ object ToolConverter {
|
||||
updateTime = tool.updateTime
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert Page<Tool> object into PageVo<ToolVo> object
|
||||
*
|
||||
* @param toolPage Page<Tool> object
|
||||
* @return PageVo<ToolVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Page
|
||||
* @see Tool
|
||||
* @see PageVo
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun toolPageToToolPageVo(toolPage: Page<Tool>): PageVo<ToolVo> = PageVo(
|
||||
total = toolPage.total,
|
||||
pages = toolPage.pages,
|
||||
|
||||
@@ -28,7 +28,7 @@ interface UserMapper : BaseMapper<User> {
|
||||
fun selectOneWithPowerInfoByAccount(@Param("account") account: String): User?
|
||||
|
||||
/**
|
||||
* Select user in page
|
||||
* Select user ID in page
|
||||
*
|
||||
* @param page Pagination
|
||||
* @param searchType Type of search
|
||||
|
||||
@@ -16,13 +16,53 @@ import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
*/
|
||||
@Mapper
|
||||
interface EditMapper : BaseMapper<Tool> {
|
||||
fun getTemplate(@Param("id") id: Long): ToolTemplate?
|
||||
/**
|
||||
* Select tool template by ID
|
||||
*
|
||||
* @param id Template ID
|
||||
* @return ToolTemplate object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolTemplate
|
||||
*/
|
||||
fun selectTemplate(@Param("id") id: Long): ToolTemplate?
|
||||
|
||||
/**
|
||||
* Select tool by ID and user ID
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @param userId User ID
|
||||
* @return Tool object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Tool
|
||||
*/
|
||||
fun selectOne(@Param("id") id: Long, @Param("userId") userId: Long): Tool?
|
||||
|
||||
/**
|
||||
* Select tool in list by User ID
|
||||
*
|
||||
* @param userId User ID
|
||||
* @return List of tool object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Tool
|
||||
*/
|
||||
fun selectPersonal(@Param("userId") userId: Long): List<Tool>
|
||||
|
||||
fun detail(
|
||||
/**
|
||||
* Select tool detail
|
||||
*
|
||||
* @param username Username
|
||||
* @param toolId Tool ID
|
||||
* @param ver Tool version
|
||||
* @param operator Operator username
|
||||
* @return List of tool object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Tool
|
||||
*/
|
||||
fun selectDetail(
|
||||
@Param("username") username: String,
|
||||
@Param("toolId") toolId: String,
|
||||
@Param("ver") ver: String,
|
||||
|
||||
@@ -16,8 +16,30 @@ import top.fatweb.oxygen.api.entity.tool.Tool
|
||||
*/
|
||||
@Mapper
|
||||
interface ManagementMapper : BaseMapper<Tool> {
|
||||
/**
|
||||
* Select tool by ID
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return Tool object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see Tool
|
||||
*/
|
||||
fun selectOne(@Param("id") id: Long): Tool?
|
||||
|
||||
/**
|
||||
* Select tool ID in page
|
||||
*
|
||||
* @param page Pagination
|
||||
* @param review Review
|
||||
* @param searchType Type of search
|
||||
* @param searchValue Value to search for
|
||||
* @param searchRegex Use regex
|
||||
* @return Tool object in page
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IPage
|
||||
*/
|
||||
fun selectPage(
|
||||
page: IPage<Long>,
|
||||
@Param("review") review: List<String>?,
|
||||
@@ -26,5 +48,13 @@ interface ManagementMapper : BaseMapper<Tool> {
|
||||
@Param("searchRegex") searchRegex: Boolean
|
||||
): IPage<Long>
|
||||
|
||||
/**
|
||||
* Select tool in list by tool IDs
|
||||
*
|
||||
* @param ids List of tool IDs
|
||||
* @return List of tool object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
fun selectListByIds(@Param("ids") ids: List<Long>): List<Tool>
|
||||
}
|
||||
@@ -15,5 +15,14 @@ import top.fatweb.oxygen.api.entity.tool.ToolBase
|
||||
*/
|
||||
@Mapper
|
||||
interface ToolBaseMapper : BaseMapper<ToolBase> {
|
||||
/**
|
||||
* Select tool base by ID
|
||||
*
|
||||
* @param id Tool base ID
|
||||
* @return ToolBase object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolBase
|
||||
*/
|
||||
fun selectOne(@Param("id") id: Long): ToolBase?
|
||||
}
|
||||
@@ -15,7 +15,24 @@ import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
*/
|
||||
@Mapper
|
||||
interface ToolTemplateMapper : BaseMapper<ToolTemplate> {
|
||||
/**
|
||||
* Select tool template by ID
|
||||
*
|
||||
* @param id Tool template ID
|
||||
* @return ToolTemplate object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolTemplate
|
||||
*/
|
||||
fun selectOne(@Param("id") id: Long): ToolTemplate?
|
||||
|
||||
/**
|
||||
* Select tool template in list
|
||||
*
|
||||
* @return List of ToolTemplate object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolTemplate
|
||||
*/
|
||||
fun selectList(): List<ToolTemplate>
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import jakarta.validation.constraints.Max
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see AvatarBaseParam
|
||||
*/
|
||||
data class AvatarGitHubParam(
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see CaptchaCodeParam
|
||||
*/
|
||||
@Schema(description = "忘记密码请求参数")
|
||||
data class ForgetParam(
|
||||
|
||||
@@ -9,6 +9,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see CaptchaCodeParam
|
||||
*/
|
||||
@Schema(description = "登录请求参数")
|
||||
data class LoginParam(
|
||||
|
||||
@@ -11,6 +11,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see CaptchaCodeParam
|
||||
*/
|
||||
@Schema(description = "注册请求参数")
|
||||
data class RegisterParam(
|
||||
|
||||
@@ -10,6 +10,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see CaptchaCodeParam
|
||||
*/
|
||||
@Schema(description = "找回密码请求参数")
|
||||
data class RetrieveParam(
|
||||
|
||||
@@ -3,6 +3,13 @@ package top.fatweb.oxygen.api.param.tool
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.oxygen.api.param.PageSortParam
|
||||
|
||||
/**
|
||||
* Get tool in management parameters
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see PageSortParam
|
||||
*/
|
||||
data class ToolManagementGetParam(
|
||||
/**
|
||||
* Type of search
|
||||
|
||||
@@ -52,7 +52,8 @@ interface IEditService : IService<Tool> {
|
||||
/**
|
||||
* Get tool by ID
|
||||
*
|
||||
* @param
|
||||
* @param id Tool ID
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -61,14 +62,20 @@ interface IEditService : IService<Tool> {
|
||||
/**
|
||||
* Create tool
|
||||
*
|
||||
* @param toolCreateParam Create tool parameters
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolCreateParam
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun create(toolCreateParam: ToolCreateParam): ToolVo
|
||||
|
||||
/**
|
||||
* Upgrade tool
|
||||
*
|
||||
* @param toolUpgradeParam Upgrade tool parameters
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolUpgradeParam
|
||||
@@ -79,30 +86,43 @@ interface IEditService : IService<Tool> {
|
||||
/**
|
||||
* Update tool
|
||||
*
|
||||
* @param toolUpdateParam Update tool parameters
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolUpdateParam
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun update(toolUpdateParam: ToolUpdateParam): ToolVo
|
||||
|
||||
/**
|
||||
* Get personal tools
|
||||
*
|
||||
* @return List of ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun get(): List<ToolVo>
|
||||
|
||||
/**
|
||||
* Get tool detail
|
||||
*
|
||||
* @param username Username
|
||||
* @param toolId Tool ID
|
||||
* @param ver Version
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun detail(username: String, toolId: String, ver: String): ToolVo
|
||||
|
||||
/**
|
||||
* Submit tool review
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return Result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -111,6 +131,8 @@ interface IEditService : IService<Tool> {
|
||||
/**
|
||||
* Cancel tool review
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return Result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -119,6 +141,8 @@ interface IEditService : IService<Tool> {
|
||||
/**
|
||||
* Delete tool
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return Result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
@@ -16,15 +16,72 @@ import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
* @see Tool
|
||||
*/
|
||||
interface IManagementService : IService<Tool> {
|
||||
/**
|
||||
* Get tool by ID
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun getOne(id: Long): ToolVo
|
||||
|
||||
/**
|
||||
* Get tool as page
|
||||
*
|
||||
* @param toolManagementGetParam Get tool parameters in tool management
|
||||
* @return PageVo<ToolVo> object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolManagementGetParam
|
||||
* @see PageVo
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun getPage(toolManagementGetParam: ToolManagementGetParam?): PageVo<ToolVo>
|
||||
|
||||
/**
|
||||
* Pass tool review
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @param toolManagementPassParam Pass tool review parameters in tool management
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolManagementPassParam
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun pass(id: Long, toolManagementPassParam: ToolManagementPassParam): ToolVo
|
||||
|
||||
/**
|
||||
* Reject tool review
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun reject(id: Long): ToolVo
|
||||
|
||||
/**
|
||||
* Off shelve tool
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return ToolVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ToolVo
|
||||
*/
|
||||
fun offShelve(id: Long): ToolVo
|
||||
|
||||
/**
|
||||
* Delete tool
|
||||
*
|
||||
* @param id Tool ID
|
||||
* @return Result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
fun delete(id: Long): Boolean
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class EditServiceImpl(
|
||||
.map(ToolTemplateConverter::toolTemplateToToolTemplateVoByList)
|
||||
|
||||
override fun getTemplate(id: Long): ToolTemplateVo =
|
||||
baseMapper.getTemplate(id)?.let(ToolTemplateConverter::toolTemplateToToolTemplateVoWithBaseDist)
|
||||
baseMapper.selectTemplate(id)?.let(ToolTemplateConverter::toolTemplateToToolTemplateVoWithBaseDist)
|
||||
?: throw NoRecordFoundException()
|
||||
|
||||
override fun getCategory(): List<ToolCategoryVo> =
|
||||
@@ -210,7 +210,7 @@ class EditServiceImpl(
|
||||
if (username == "!" && WebUtil.getLoginUserId() == null) {
|
||||
throw NoRecordFoundException()
|
||||
}
|
||||
val toolList = baseMapper.detail(username, toolId, ver, WebUtil.getLoginUsername())
|
||||
val toolList = baseMapper.selectDetail(username, toolId, ver, WebUtil.getLoginUsername())
|
||||
if (toolList.isNullOrEmpty()) {
|
||||
throw NoRecordFoundException()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.fatweb.oxygen.api.mapper.tool.EditMapper">
|
||||
<select id="getTemplate" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolTemplateWithBaseDataMap">
|
||||
<select id="selectTemplate" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolTemplateWithBaseDataMap">
|
||||
select t_b_tool_template.id as tool_template_id,
|
||||
t_b_tool_template.name as tool_template_name,
|
||||
t_b_tool_template.base_id as tool_template_base_id,
|
||||
@@ -128,7 +128,7 @@
|
||||
order by t_b_tool_main.id desc
|
||||
</select>
|
||||
|
||||
<select id="detail" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
||||
<select id="selectDetail" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
||||
select t_b_tool_main.id as tool_id,
|
||||
t_b_tool_main.name as tool_name,
|
||||
t_b_tool_main.tool_id as tool_tool_id,
|
||||
|
||||
Reference in New Issue
Block a user