Add tool management api
This commit is contained in:
@@ -1,30 +1,88 @@
|
|||||||
package top.fatweb.oxygen.api.controller.tool
|
package top.fatweb.oxygen.api.controller.tool
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
|
import org.springframework.web.bind.annotation.PatchMapping
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping
|
||||||
import top.fatweb.oxygen.api.annotation.BaseController
|
import top.fatweb.oxygen.api.annotation.BaseController
|
||||||
|
import top.fatweb.oxygen.api.entity.common.ResponseCode
|
||||||
|
import top.fatweb.oxygen.api.entity.common.ResponseResult
|
||||||
|
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
|
||||||
|
import top.fatweb.oxygen.api.service.tool.IManagementService
|
||||||
|
import top.fatweb.oxygen.api.vo.PageVo
|
||||||
|
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||||
|
|
||||||
@BaseController(path = ["/system/tool"], name = "工具管理", description = "工具管理相关接口")
|
@BaseController(path = ["/system/tool"], name = "工具管理", description = "工具管理相关接口")
|
||||||
class ManagementController {
|
class ManagementController(
|
||||||
/* @Operation(summary = "获取单个工具")
|
private val managementService: IManagementService
|
||||||
@GetMapping("/{id}")
|
) {
|
||||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolVo> =
|
/**
|
||||||
ResponseResult.databaseSuccess(data = toolService.getOne(id))
|
* Get tool by ID
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取单个工具")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
fun getOne(@PathVariable id: Long): ResponseResult<ToolVo> =
|
||||||
|
ResponseResult.databaseSuccess(data = managementService.getOne(id))
|
||||||
|
|
||||||
@Operation(summary = "获取工具")
|
/**
|
||||||
@GetMapping
|
* Get tool paging information
|
||||||
fun get(): ResponseResult<List<ToolVo>> =
|
*
|
||||||
ResponseResult.databaseSuccess(data = toolService.get())
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取工具")
|
||||||
|
@GetMapping
|
||||||
|
fun get(toolManagementGetParam: ToolManagementGetParam): ResponseResult<PageVo<ToolVo>> =
|
||||||
|
ResponseResult.databaseSuccess(data = managementService.getPage(toolManagementGetParam))
|
||||||
|
|
||||||
@Operation(summary = "更新工具")
|
/**
|
||||||
@PutMapping
|
* Pass tool review
|
||||||
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> =
|
*
|
||||||
ResponseResult.databaseSuccess(
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
* @since 1.0.0
|
||||||
data = toolService.update(toolUpdateParam)
|
*/
|
||||||
)
|
@Operation(summary = "通过审核")
|
||||||
|
@PostMapping("/{id}")
|
||||||
|
fun pass(@PathVariable id: Long): ResponseResult<ToolVo> =
|
||||||
|
ResponseResult.databaseSuccess(ResponseCode.DATABASE_UPDATE_SUCCESS, data = managementService.pass(id))
|
||||||
|
|
||||||
@Operation(summary = "删除工具")
|
/**
|
||||||
@DeleteMapping("/{id}")
|
* Reject tool review
|
||||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
*
|
||||||
if (toolService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FAILED)*/
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Operation(summary = "驳回审核")
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
fun reject(@PathVariable id: Long): ResponseResult<ToolVo> =
|
||||||
|
ResponseResult.databaseSuccess(ResponseCode.DATABASE_UPDATE_SUCCESS, data = managementService.reject(id))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put off shelve
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Operation(summary = "下架")
|
||||||
|
@PatchMapping("/{id}")
|
||||||
|
fun offShelve(@PathVariable id: Long):ResponseResult<ToolVo> =
|
||||||
|
ResponseResult.databaseSuccess(ResponseCode.DATABASE_UPDATE_SUCCESS, data = managementService.offShelve(id))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete tool
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Operation(summary = "删除工具")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||||
|
if (managementService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||||
|
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FAILED)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package top.fatweb.oxygen.api.converter.tool
|
package top.fatweb.oxygen.api.converter.tool
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
import top.fatweb.oxygen.api.converter.permission.UserConverter
|
import top.fatweb.oxygen.api.converter.permission.UserConverter
|
||||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
import top.fatweb.oxygen.api.entity.tool.Tool
|
||||||
|
import top.fatweb.oxygen.api.vo.PageVo
|
||||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,4 +42,12 @@ object ToolConverter {
|
|||||||
createTime = tool.createTime,
|
createTime = tool.createTime,
|
||||||
updateTime = tool.updateTime
|
updateTime = tool.updateTime
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun toolPageToToolPageVo(toolPage: Page<Tool>): PageVo<ToolVo> = PageVo(
|
||||||
|
total = toolPage.total,
|
||||||
|
pages = toolPage.pages,
|
||||||
|
size = toolPage.size,
|
||||||
|
current = toolPage.current,
|
||||||
|
records = toolPage.records.map(this::toolToToolVo)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,8 @@ enum class ResponseCode(val code: Int) {
|
|||||||
TOOL_UNDER_REVIEW(BusinessCode.TOOL, 51),
|
TOOL_UNDER_REVIEW(BusinessCode.TOOL, 51),
|
||||||
TOOL_NOT_UNDER_REVIEW(BusinessCode.TOOL, 52),
|
TOOL_NOT_UNDER_REVIEW(BusinessCode.TOOL, 52),
|
||||||
TOOL_HAS_UNPUBLISHED_VERSION(BusinessCode.TOOL, 53),
|
TOOL_HAS_UNPUBLISHED_VERSION(BusinessCode.TOOL, 53),
|
||||||
TOOL_HAS_BEEN_PUBLISHED(BusinessCode.TOOL, 54),
|
TOOL_HAS_NOT_BEEN_PUBLISHED(BusinessCode.TOOL, 54),
|
||||||
|
TOOL_HAS_BEEN_PUBLISHED(BusinessCode.TOOL, 55),
|
||||||
TOOL_SUBMIT_ERROR(BusinessCode.TOOL, 60),
|
TOOL_SUBMIT_ERROR(BusinessCode.TOOL, 60),
|
||||||
TOOL_CANCEL_ERROR(BusinessCode.TOOL, 61),
|
TOOL_CANCEL_ERROR(BusinessCode.TOOL, 61),
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package top.fatweb.oxygen.api.exception
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tool has not been published exception
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
* @see RuntimeException
|
||||||
|
*/
|
||||||
|
class ToolHasNotBeenPublishedException : RuntimeException("Tool has not been published")
|
||||||
@@ -232,6 +232,11 @@ class ExceptionHandler {
|
|||||||
ResponseResult.fail(ResponseCode.TOOL_HAS_UNPUBLISHED_VERSION, e.localizedMessage, null)
|
ResponseResult.fail(ResponseCode.TOOL_HAS_UNPUBLISHED_VERSION, e.localizedMessage, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is ToolHasNotBeenPublishedException -> {
|
||||||
|
logger.debug(e.localizedMessage, e)
|
||||||
|
ResponseResult.fail(ResponseCode.TOOL_HAS_NOT_BEEN_PUBLISHED, e.localizedMessage, null)
|
||||||
|
}
|
||||||
|
|
||||||
is ToolHasBeenPublishedException -> {
|
is ToolHasBeenPublishedException -> {
|
||||||
logger.debug(e.localizedMessage, e)
|
logger.debug(e.localizedMessage, e)
|
||||||
ResponseResult.fail(ResponseCode.TOOL_HAS_BEEN_PUBLISHED, e.localizedMessage, null)
|
ResponseResult.fail(ResponseCode.TOOL_HAS_BEEN_PUBLISHED, e.localizedMessage, null)
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package top.fatweb.oxygen.api.mapper.tool
|
||||||
|
|
||||||
|
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.Tool
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tool mapper
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
* @see BaseMapper
|
||||||
|
* @see Tool
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
interface ManagementMapper : BaseMapper<Tool> {
|
||||||
|
fun selectOne(@Param("id") id: Long): Tool?
|
||||||
|
|
||||||
|
fun selectPage(
|
||||||
|
page: IPage<Long>,
|
||||||
|
@Param("review") review: List<String>?,
|
||||||
|
@Param("searchType") searchType: String,
|
||||||
|
@Param("searchValue") searchValue: String?,
|
||||||
|
@Param("searchRegex") searchRegex: Boolean
|
||||||
|
): IPage<Long>
|
||||||
|
|
||||||
|
fun selectListByIds(@Param("ids") ids: List<Long>): List<Tool>
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package top.fatweb.oxygen.api.mapper.tool
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
|
||||||
import org.apache.ibatis.annotations.Mapper
|
|
||||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tool mapper
|
|
||||||
*
|
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
|
||||||
* @since 1.0.0
|
|
||||||
* @see BaseMapper
|
|
||||||
* @see Tool
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
interface ToolMapper : BaseMapper<Tool>
|
|
||||||
@@ -20,7 +20,11 @@ data class SysLogGetParam(
|
|||||||
* @author FatttSnake, fatttsnake@gmail.com
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
@Schema(description = "类型过滤(多个使用逗号分隔)", allowableValues = ["INFO", "ERROR"], example = "INFO")
|
@Schema(
|
||||||
|
description = "类型过滤(多个使用逗号分隔)",
|
||||||
|
allowableValues = ["INFO", "LOGIN", "LOGOUT", "REGISTER", "STATISTICS", "API", "ERROR"],
|
||||||
|
example = "INFO"
|
||||||
|
)
|
||||||
val logType: String?,
|
val logType: String?,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,10 +55,10 @@ data class SysLogGetParam(
|
|||||||
* @author FatttSnake, fatttsnake@gmail.com
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false")
|
@Schema(description = "查询使用正则表达式", allowableValues = ["true", "false"], defaultValue = "false")
|
||||||
val searchRegex: Boolean = false,
|
val searchRegex: Boolean = false,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start time to search for
|
* Start time to search for
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package top.fatweb.oxygen.api.param.tool
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
|
import top.fatweb.oxygen.api.param.PageSortParam
|
||||||
|
|
||||||
|
data class ToolManagementGetParam(
|
||||||
|
/**
|
||||||
|
* Type of search
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Schema(
|
||||||
|
description = "搜索类型",
|
||||||
|
allowableValues = ["ALL", "ID", "USERNAME", "NICKNAME", "EMAIL"],
|
||||||
|
defaultValue = "ALL",
|
||||||
|
example = "ALL"
|
||||||
|
)
|
||||||
|
val searchType: String = "ALL",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value to search for
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Schema(description = "查询内容", example = "ToolName")
|
||||||
|
val searchValue: String?,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use regex
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Schema(
|
||||||
|
description = "查询使用正则表达式",
|
||||||
|
allowableValues = ["true", "false"],
|
||||||
|
defaultValue = "false",
|
||||||
|
example = "false"
|
||||||
|
)
|
||||||
|
val searchRegex: Boolean = false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Review
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Schema(description = "审核状态过滤(多个使用逗号分隔)",
|
||||||
|
allowableValues = ["NONE", "PROCESSING", "REJECT", "PASS"],
|
||||||
|
example = "NONE,PASS")
|
||||||
|
val review: String?
|
||||||
|
) : PageSortParam()
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package top.fatweb.oxygen.api.service.tool
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService
|
||||||
|
import top.fatweb.oxygen.api.entity.tool.Tool
|
||||||
|
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
|
||||||
|
import top.fatweb.oxygen.api.vo.PageVo
|
||||||
|
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tool management service interface
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
* @see IService
|
||||||
|
* @see Tool
|
||||||
|
*/
|
||||||
|
interface IManagementService : IService<Tool> {
|
||||||
|
fun getOne(id: Long): ToolVo
|
||||||
|
|
||||||
|
fun getPage(toolManagementGetParam: ToolManagementGetParam?): PageVo<ToolVo>
|
||||||
|
|
||||||
|
fun pass(id: Long): ToolVo
|
||||||
|
|
||||||
|
fun reject(id: Long): ToolVo
|
||||||
|
|
||||||
|
fun offShelve(id: Long): ToolVo
|
||||||
|
|
||||||
|
fun delete(id: Long): Boolean
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package top.fatweb.oxygen.api.service.tool
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService
|
|
||||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tool service interface
|
|
||||||
*
|
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
|
||||||
* @since 1.0.0
|
|
||||||
* @see IService
|
|
||||||
* @see Tool
|
|
||||||
*/
|
|
||||||
interface IToolService : IService<Tool>
|
|
||||||
@@ -190,7 +190,9 @@ class EditServiceImpl(
|
|||||||
categoryId = it
|
categoryId = it
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!toolUpdateParam.source.isNullOrBlank()) {
|
||||||
toolDataService.updateById(ToolData().apply {
|
toolDataService.updateById(ToolData().apply {
|
||||||
id = tool.sourceId
|
id = tool.sourceId
|
||||||
data = toolUpdateParam.source
|
data = toolUpdateParam.source
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package top.fatweb.oxygen.api.service.tool.impl
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem
|
||||||
|
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
|
||||||
|
import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import top.fatweb.oxygen.api.converter.tool.ToolConverter
|
||||||
|
import top.fatweb.oxygen.api.entity.tool.RToolCategory
|
||||||
|
import top.fatweb.oxygen.api.entity.tool.Tool
|
||||||
|
import top.fatweb.oxygen.api.exception.NoRecordFoundException
|
||||||
|
import top.fatweb.oxygen.api.exception.ToolHasNotBeenPublishedException
|
||||||
|
import top.fatweb.oxygen.api.exception.ToolNotUnderReviewException
|
||||||
|
import top.fatweb.oxygen.api.mapper.tool.ManagementMapper
|
||||||
|
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
|
||||||
|
import top.fatweb.oxygen.api.service.tool.IEditService
|
||||||
|
import top.fatweb.oxygen.api.service.tool.IManagementService
|
||||||
|
import top.fatweb.oxygen.api.service.tool.IRToolCategoryService
|
||||||
|
import top.fatweb.oxygen.api.service.tool.IToolDataService
|
||||||
|
import top.fatweb.oxygen.api.util.PageUtil
|
||||||
|
import top.fatweb.oxygen.api.util.WebUtil
|
||||||
|
import top.fatweb.oxygen.api.vo.PageVo
|
||||||
|
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.ZoneOffset
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tool management service implement
|
||||||
|
*
|
||||||
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
|
* @since 1.0.0
|
||||||
|
* @see ServiceImpl
|
||||||
|
* @see ManagementMapper
|
||||||
|
* @see Tool
|
||||||
|
* @see IManagementService
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
class ManagementServiceImpl(
|
||||||
|
private val toolDataService: IToolDataService,
|
||||||
|
private val rToolCategoryService: IRToolCategoryService
|
||||||
|
) : ServiceImpl<ManagementMapper, Tool>(), IManagementService {
|
||||||
|
override fun getOne(id: Long): ToolVo =
|
||||||
|
baseMapper.selectOne(id)
|
||||||
|
?.let(ToolConverter::toolToToolVo) ?: throw NoRecordFoundException()
|
||||||
|
override fun getPage(toolManagementGetParam: ToolManagementGetParam?): PageVo<ToolVo> {
|
||||||
|
val toolIdsPage = Page<Long>(toolManagementGetParam?.currentPage ?: 1, toolManagementGetParam?.pageSize ?: 20)
|
||||||
|
|
||||||
|
PageUtil.setPageSort(toolManagementGetParam, toolIdsPage, OrderItem.desc("id"))
|
||||||
|
|
||||||
|
val toolIdsIPage =
|
||||||
|
baseMapper.selectPage(
|
||||||
|
toolIdsPage,
|
||||||
|
toolManagementGetParam?.review?.split(","),
|
||||||
|
toolManagementGetParam?.searchType ?: "ALL",
|
||||||
|
toolManagementGetParam?.searchValue,
|
||||||
|
toolManagementGetParam?.searchRegex ?: false
|
||||||
|
)
|
||||||
|
val toolPage = Page<Tool>(toolIdsIPage.current, toolIdsIPage.size, toolIdsIPage.total)
|
||||||
|
if (toolIdsIPage.total > 0) {
|
||||||
|
toolPage.setRecords(baseMapper.selectListByIds(toolIdsIPage.records))
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToolConverter.toolPageToToolPageVo(toolPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun pass(id: Long): ToolVo {
|
||||||
|
val tool = this.getById(id) ?: throw NoRecordFoundException()
|
||||||
|
if (tool.review !== Tool.ReviewType.PROCESSING) {
|
||||||
|
throw ToolNotUnderReviewException()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update(
|
||||||
|
KtUpdateWrapper(Tool())
|
||||||
|
.eq(Tool::id, id)
|
||||||
|
.set(Tool::review, Tool.ReviewType.PASS)
|
||||||
|
.set(Tool::publish, LocalDateTime.now(ZoneOffset.UTC).toInstant(ZoneOffset.UTC).toEpochMilli())
|
||||||
|
)
|
||||||
|
|
||||||
|
return this.getOne(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reject(id: Long): ToolVo {
|
||||||
|
val tool = this.getById(id) ?: throw NoRecordFoundException()
|
||||||
|
if (tool.review !== Tool.ReviewType.PROCESSING) {
|
||||||
|
throw ToolNotUnderReviewException()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update(
|
||||||
|
KtUpdateWrapper(Tool())
|
||||||
|
.eq(Tool::id, id)
|
||||||
|
.set(Tool::review, Tool.ReviewType.REJECT)
|
||||||
|
)
|
||||||
|
|
||||||
|
return this.getOne(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun offShelve(id: Long): ToolVo {
|
||||||
|
val tool = this.getById(id) ?: throw NoRecordFoundException()
|
||||||
|
if (tool.review !== Tool.ReviewType.PASS && tool.publish == 0L) {
|
||||||
|
throw ToolHasNotBeenPublishedException()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update(
|
||||||
|
KtUpdateWrapper(Tool())
|
||||||
|
.eq(Tool::id, id)
|
||||||
|
.set(Tool::review, Tool.ReviewType.REJECT)
|
||||||
|
.set(Tool::publish, 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
return this.getOne(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
override fun delete(id: Long): Boolean {
|
||||||
|
val tool = this.getById(id) ?: throw NoRecordFoundException()
|
||||||
|
|
||||||
|
toolDataService.removeBatchByIds(listOf(tool.sourceId, tool.distId))
|
||||||
|
rToolCategoryService.remove(KtQueryWrapper(RToolCategory()).eq(RToolCategory::toolId, id))
|
||||||
|
|
||||||
|
return this.removeById(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
package top.fatweb.oxygen.api.service.tool.impl
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
|
||||||
import top.fatweb.oxygen.api.mapper.tool.ToolMapper
|
|
||||||
import top.fatweb.oxygen.api.service.tool.IToolService
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tool service implement
|
|
||||||
*
|
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
|
||||||
* @since 1.0.0
|
|
||||||
* @see ServiceImpl
|
|
||||||
* @see ToolMapper
|
|
||||||
* @see Tool
|
|
||||||
* @see IToolService
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
class ToolServiceImpl : ServiceImpl<ToolMapper, Tool>(), IToolService {
|
|
||||||
/*
|
|
||||||
override fun getOne(id: Long): ToolVo =
|
|
||||||
baseMapper.selectOne(id)?.let(ToolConverter::toolToToolVo) ?: throw NoRecordFoundException()
|
|
||||||
|
|
||||||
override fun get(): List<ToolVo> = baseMapper.selectList().map(ToolConverter::toolToToolVo)
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
override fun update(toolUpdateParam: ToolUpdateParam): ToolVo {
|
|
||||||
val tool = baseMapper.selectOne(toolUpdateParam.id!!) ?: throw NoRecordFoundException()
|
|
||||||
if (tool.publish == 1) {
|
|
||||||
throw ToolHasPublish()
|
|
||||||
}
|
|
||||||
userService.getOne(toolUpdateParam.authorId!!)
|
|
||||||
|
|
||||||
toolDataService.updateById(ToolData().apply {
|
|
||||||
id = tool.sourceId
|
|
||||||
data = toolUpdateParam.source
|
|
||||||
})
|
|
||||||
|
|
||||||
toolDataService.updateById(ToolData().apply {
|
|
||||||
id = tool.distId
|
|
||||||
data = toolUpdateParam.dist
|
|
||||||
})
|
|
||||||
|
|
||||||
this.updateById(Tool().apply {
|
|
||||||
id = toolUpdateParam.id
|
|
||||||
name = toolUpdateParam.name
|
|
||||||
toolId = toolUpdateParam.toolId
|
|
||||||
description = toolUpdateParam.description
|
|
||||||
authorId = toolUpdateParam.authorId
|
|
||||||
ver = toolUpdateParam.ver
|
|
||||||
privately = toolUpdateParam.privately?.let { if (it) 1 else 0 }
|
|
||||||
keywords = toolUpdateParam.keywords
|
|
||||||
})
|
|
||||||
|
|
||||||
// TODO Category process
|
|
||||||
|
|
||||||
return this.getOne(tool.id!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
override fun delete(id: Long): Boolean {
|
|
||||||
val tool = this.getById(id)
|
|
||||||
|
|
||||||
return toolDataService.removeBatchByIds(listOf(tool.sourceId, tool.distId))
|
|
||||||
&& rToolCategoryService.remove(KtQueryWrapper(RToolCategory()).eq(RToolCategory::toolId, tool.id))
|
|
||||||
&& this.removeById(tool.id)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -38,11 +38,16 @@
|
|||||||
left join (select * from t_r_role_group where deleted = 0) as trrg on t_s_group.id = trrg.group_id
|
left join (select * from t_r_role_group where deleted = 0) as trrg on t_s_group.id = trrg.group_id
|
||||||
left join (select * from t_s_role where deleted = 0) as tsr on tsr.id = trrg.role_id
|
left join (select * from t_s_role where deleted = 0) as tsr on tsr.id = trrg.role_id
|
||||||
<where>
|
<where>
|
||||||
<foreach collection="groupIds" item="item" index="index" open="and t_s_group.id in (" separator="," close=")"
|
<foreach collection="groupIds" item="item" index="index" open="and t_s_group.id in (" separator=","
|
||||||
|
close=")"
|
||||||
nullable="true">
|
nullable="true">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</where>
|
</where>
|
||||||
|
<foreach collection="groupIds" item="item" index="index" open="order by field(t_s_group.id," separator=","
|
||||||
|
close=")" nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOneById" resultMap="groupWithRoleMap">
|
<select id="selectOneById" resultMap="groupWithRoleMap">
|
||||||
|
|||||||
@@ -55,6 +55,10 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</where>
|
</where>
|
||||||
|
<foreach collection="roleIds" item="item" index="index" open="order by field(t_s_role.id," separator=","
|
||||||
|
close=")" nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOneById" resultMap="roleWithPowerMap">
|
<select id="selectOneById" resultMap="roleWithPowerMap">
|
||||||
|
|||||||
@@ -175,6 +175,10 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</where>
|
</where>
|
||||||
|
<foreach collection="userIds" item="item" index="index" open="order by field(t_s_user.id," separator=","
|
||||||
|
close=")" nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOneWithRoleInfoById" resultMap="userWithRoleInfoMap">
|
<select id="selectOneWithRoleInfoById" resultMap="userWithRoleInfoMap">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<mapper namespace="top.fatweb.oxygen.api.mapper.tool.EditMapper">
|
||||||
<select id="getTemplate" resultMap="toolTemplateWithBaseDataMap">
|
<select id="getTemplate" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolTemplateWithBaseDataMap">
|
||||||
select t_b_tool_template.id as tool_template_id,
|
select t_b_tool_template.id as tool_template_id,
|
||||||
t_b_tool_template.name as tool_template_name,
|
t_b_tool_template.name as tool_template_name,
|
||||||
t_b_tool_template.base_id as tool_template_base_id,
|
t_b_tool_template.base_id as tool_template_base_id,
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
and t_b_tool_template.id = #{id}
|
and t_b_tool_template.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOne" resultMap="toolWithDataMap">
|
<select id="selectOne" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
||||||
select t_b_tool_main.id as tool_id,
|
select t_b_tool_main.id as tool_id,
|
||||||
t_b_tool_main.name as tool_name,
|
t_b_tool_main.name as tool_name,
|
||||||
t_b_tool_main.tool_id as tool_tool_id,
|
t_b_tool_main.tool_id as tool_tool_id,
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
and t_b_tool_main.id = #{id}
|
and t_b_tool_main.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPersonal" resultMap="toolMap">
|
<select id="selectPersonal" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolMap">
|
||||||
select t_b_tool_main.id as tool_id,
|
select t_b_tool_main.id as tool_id,
|
||||||
t_b_tool_main.name as tool_name,
|
t_b_tool_main.name as tool_name,
|
||||||
t_b_tool_main.tool_id as tool_tool_id,
|
t_b_tool_main.tool_id as tool_tool_id,
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
order by t_b_tool_main.id desc
|
order by t_b_tool_main.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="detail" resultMap="toolWithDataMap">
|
<select id="detail" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithDataMap">
|
||||||
select t_b_tool_main.id as tool_id,
|
select t_b_tool_main.id as tool_id,
|
||||||
t_b_tool_main.name as tool_name,
|
t_b_tool_main.name as tool_name,
|
||||||
t_b_tool_main.tool_id as tool_tool_id,
|
t_b_tool_main.tool_id as tool_tool_id,
|
||||||
@@ -209,60 +209,4 @@
|
|||||||
</where>
|
</where>
|
||||||
order by t_b_tool_main.id desc
|
order by t_b_tool_main.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<resultMap id="toolTemplateWithBaseDataMap" type="toolTemplate"
|
|
||||||
extends="top.fatweb.oxygen.api.mapper.tool.ToolTemplateMapper.toolTemplateWithDataMap">
|
|
||||||
<association property="base">
|
|
||||||
<id property="id" column="tool_template_base_id"/>
|
|
||||||
<result property="name" column="tool_template_base_name"/>
|
|
||||||
<result property="distData" column="tool_template_base_dist_data"/>
|
|
||||||
</association>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<resultMap id="toolMap" type="tool">
|
|
||||||
<id property="id" column="tool_id"/>
|
|
||||||
<result property="name" column="tool_name"/>
|
|
||||||
<result property="toolId" column="tool_tool_id"/>
|
|
||||||
<result property="icon" column="tool_icon"/>
|
|
||||||
<result property="description" column="tool_description"/>
|
|
||||||
<result property="baseId" column="tool_base_id"/>
|
|
||||||
<result property="authorId" column="tool_author_id"/>
|
|
||||||
<result property="ver" column="tool_ver"/>
|
|
||||||
<result property="sourceId" column="tool_source_id"/>
|
|
||||||
<result property="distId" column="tool_dist_id"/>
|
|
||||||
<result property="entryPoint" column="tool_entry_point"/>
|
|
||||||
<result property="publish" column="tool_publish"/>
|
|
||||||
<result property="review" column="tool_review"/>
|
|
||||||
<result property="updateTime" column="tool_update_time"/>
|
|
||||||
<result property="createTime" column="tool_create_time"/>
|
|
||||||
<result property="deleted" column="tool_deleted"/>
|
|
||||||
<result property="version" column="tool_version"/>
|
|
||||||
<result property="keywords" column="tool_keywords" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
|
|
||||||
<collection property="categories"
|
|
||||||
resultMap="top.fatweb.oxygen.api.mapper.tool.ToolCategoryMapper.toolCategoryMap"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<resultMap id="toolWithAuthor" type="tool" extends="toolMap">
|
|
||||||
<association property="author" resultMap="top.fatweb.oxygen.api.mapper.permission.UserMapper.userWithInfoMap"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<resultMap id="toolWithDataMap" type="tool" extends="toolWithAuthor">
|
|
||||||
<association property="base" resultMap="top.fatweb.oxygen.api.mapper.tool.ToolBaseMapper.toolBaseWithDataMap"/>
|
|
||||||
<association property="source">
|
|
||||||
<id property="id" column="tool_source_id"/>
|
|
||||||
<result property="data" column="tool_source_data"/>
|
|
||||||
<result property="createTime" column="tool_source_create_time"/>
|
|
||||||
<result property="updateTime" column="tool_source_update_time"/>
|
|
||||||
<result property="deleted" column="tool_source_deleted"/>
|
|
||||||
<result property="version" column="tool_source_version"/>
|
|
||||||
</association>
|
|
||||||
<association property="dist">
|
|
||||||
<id property="id" column="tool_dist_id"/>
|
|
||||||
<result property="data" column="tool_dist_data"/>
|
|
||||||
<result property="createTime" column="tool_dist_create_time"/>
|
|
||||||
<result property="updateTime" column="tool_dist_update_time"/>
|
|
||||||
<result property="deleted" column="tool_dist_deleted"/>
|
|
||||||
<result property="version" column="tool_dist_version"/>
|
|
||||||
</association>
|
|
||||||
</resultMap>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
184
src/main/resources/mapper/tool/ManagementMapper.xml
Normal file
184
src/main/resources/mapper/tool/ManagementMapper.xml
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
<?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.ManagementMapper">
|
||||||
|
<select id="selectOne" resultMap="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,
|
||||||
|
t_b_tool_main.icon as tool_icon,
|
||||||
|
t_b_tool_main.description as tool_description,
|
||||||
|
t_b_tool_main.base_id as tool_base_id,
|
||||||
|
t_b_tool_main.author_id as tool_author_id,
|
||||||
|
t_b_tool_main.ver as tool_ver,
|
||||||
|
t_b_tool_main.keywords as tool_keywords,
|
||||||
|
t_b_tool_main.source_id as tool_source_id,
|
||||||
|
t_b_tool_main.dist_id as tool_dist_id,
|
||||||
|
t_b_tool_main.entry_point as tool_entry_point,
|
||||||
|
t_b_tool_main.publish as tool_publish,
|
||||||
|
t_b_tool_main.review as tool_review,
|
||||||
|
t_b_tool_main.create_time as tool_create_time,
|
||||||
|
t_b_tool_main.update_time as tool_update_time,
|
||||||
|
t_b_tool_main.deleted as tool_deleted,
|
||||||
|
t_b_tool_main.version as tool_version,
|
||||||
|
tsu.id as user_id,
|
||||||
|
tsu.username as user_username,
|
||||||
|
tsui.id as user_info_id,
|
||||||
|
tsui.nickname as user_info_nickname,
|
||||||
|
tsui.avatar as user_info_avatar,
|
||||||
|
tsui.email as user_info_email,
|
||||||
|
tbtb.name as tool_base_name,
|
||||||
|
tbtb.dist_id as tool_base_dist_id,
|
||||||
|
tbtbd.data as tool_base_dist_data,
|
||||||
|
tbts.data as tool_source_data,
|
||||||
|
tbts.create_time as tool_source_create_time,
|
||||||
|
tbts.update_time as tool_source_update_time,
|
||||||
|
tbts.deleted as tool_source_deleted,
|
||||||
|
tbts.version as tool_source_version,
|
||||||
|
tbtd.data as tool_dist_data,
|
||||||
|
tbtd.create_time as tool_dist_create_time,
|
||||||
|
tbtd.update_time as tool_dist_update_time,
|
||||||
|
tbtd.deleted as tool_dist_deleted,
|
||||||
|
tbtd.version as tool_dist_version,
|
||||||
|
tbtc.id as tool_category_id,
|
||||||
|
tbtc.name as tool_category_name,
|
||||||
|
tbtc.enable as tool_category_enable,
|
||||||
|
tbtc.create_time as tool_category_create_time,
|
||||||
|
tbtc.update_time as tool_category_update_time,
|
||||||
|
tbtc.deleted as tool_category_deleted,
|
||||||
|
tbtc.version as tool_category_version
|
||||||
|
from t_b_tool_main
|
||||||
|
left join (select * from t_s_user where deleted = 0) as tsu on tsu.id = t_b_tool_main.author_id
|
||||||
|
left join (select * from t_s_user_info where deleted = 0) as tsui
|
||||||
|
on tsui.user_id = t_b_tool_main.author_id
|
||||||
|
left join (select * from t_b_tool_base where deleted = 0) as tbtb on tbtb.id = t_b_tool_main.base_id
|
||||||
|
left join (select * from t_b_tool_data where deleted = 0) as tbtbd on tbtbd.id = tbtb.dist_id
|
||||||
|
left join (select * from t_b_tool_data where deleted = 0) as tbts on tbts.id = t_b_tool_main.source_id
|
||||||
|
left join (select * from t_b_tool_data where deleted = 0) as tbtd on tbtd.id = t_b_tool_main.dist_id
|
||||||
|
left join (select * from t_r_tool_main_category where deleted = 0) as trtmc
|
||||||
|
on t_b_tool_main.id = trtmc.tool_id
|
||||||
|
left join (select * from t_b_tool_category where deleted = 0 and enable = 1) as tbtc
|
||||||
|
on tbtc.id = trtmc.category_id
|
||||||
|
where t_b_tool_main.deleted = 0
|
||||||
|
and t_b_tool_main.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPage" resultType="long">
|
||||||
|
select t_b_tool_main.id
|
||||||
|
from t_b_tool_main
|
||||||
|
<where>
|
||||||
|
t_b_tool_main.deleted = 0
|
||||||
|
<foreach collection="review" item="item" index="index" open="and t_b_tool_main.review in (" separator=","
|
||||||
|
close=")" nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectListByIds" resultMap="toolWithAuthor">
|
||||||
|
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,
|
||||||
|
t_b_tool_main.icon as tool_icon,
|
||||||
|
t_b_tool_main.description as tool_description,
|
||||||
|
t_b_tool_main.base_id as tool_base_id,
|
||||||
|
t_b_tool_main.author_id as tool_author_id,
|
||||||
|
t_b_tool_main.ver as tool_ver,
|
||||||
|
t_b_tool_main.keywords as tool_keywords,
|
||||||
|
t_b_tool_main.source_id as tool_source_id,
|
||||||
|
t_b_tool_main.dist_id as tool_dist_id,
|
||||||
|
t_b_tool_main.entry_point as tool_entry_point,
|
||||||
|
t_b_tool_main.publish as tool_publish,
|
||||||
|
t_b_tool_main.review as tool_review,
|
||||||
|
t_b_tool_main.create_time as tool_create_time,
|
||||||
|
t_b_tool_main.update_time as tool_update_time,
|
||||||
|
t_b_tool_main.deleted as tool_deleted,
|
||||||
|
t_b_tool_main.version as tool_version,
|
||||||
|
tsu.id as user_id,
|
||||||
|
tsu.username as user_username,
|
||||||
|
tsui.id as user_info_id,
|
||||||
|
tsui.nickname as user_info_nickname,
|
||||||
|
tsui.avatar as user_info_avatar,
|
||||||
|
tsui.email as user_info_email,
|
||||||
|
tbtc.id as tool_category_id,
|
||||||
|
tbtc.name as tool_category_name,
|
||||||
|
tbtc.enable as tool_category_enable,
|
||||||
|
tbtc.create_time as tool_category_create_time,
|
||||||
|
tbtc.update_time as tool_category_update_time,
|
||||||
|
tbtc.deleted as tool_category_deleted,
|
||||||
|
tbtc.version as tool_category_version
|
||||||
|
from t_b_tool_main
|
||||||
|
left join (select * from t_s_user where deleted = 0) as tsu on tsu.id = t_b_tool_main.author_id
|
||||||
|
left join (select * from t_s_user_info where deleted = 0) as tsui
|
||||||
|
on tsui.user_id = t_b_tool_main.author_id
|
||||||
|
left join (select * from t_r_tool_main_category where deleted = 0) as trtmc
|
||||||
|
on t_b_tool_main.id = trtmc.tool_id
|
||||||
|
left join (select * from t_b_tool_category where deleted = 0 and enable = 1) as tbtc
|
||||||
|
on tbtc.id = trtmc.category_id
|
||||||
|
<where>
|
||||||
|
<foreach collection="ids" item="item" index="index" open="and t_b_tool_main.id in (" separator="," close=")"
|
||||||
|
nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
<foreach collection="ids" item="item" index="index" open="order by field(t_b_tool_main.id," separator=","
|
||||||
|
close=")" nullable="true">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="toolTemplateWithBaseDataMap" type="toolTemplate"
|
||||||
|
extends="top.fatweb.oxygen.api.mapper.tool.ToolTemplateMapper.toolTemplateWithDataMap">
|
||||||
|
<association property="base">
|
||||||
|
<id property="id" column="tool_template_base_id"/>
|
||||||
|
<result property="name" column="tool_template_base_name"/>
|
||||||
|
<result property="distData" column="tool_template_base_dist_data"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="toolMap" type="tool">
|
||||||
|
<id property="id" column="tool_id"/>
|
||||||
|
<result property="name" column="tool_name"/>
|
||||||
|
<result property="toolId" column="tool_tool_id"/>
|
||||||
|
<result property="icon" column="tool_icon"/>
|
||||||
|
<result property="description" column="tool_description"/>
|
||||||
|
<result property="baseId" column="tool_base_id"/>
|
||||||
|
<result property="authorId" column="tool_author_id"/>
|
||||||
|
<result property="ver" column="tool_ver"/>
|
||||||
|
<result property="sourceId" column="tool_source_id"/>
|
||||||
|
<result property="distId" column="tool_dist_id"/>
|
||||||
|
<result property="entryPoint" column="tool_entry_point"/>
|
||||||
|
<result property="publish" column="tool_publish"/>
|
||||||
|
<result property="review" column="tool_review"/>
|
||||||
|
<result property="updateTime" column="tool_update_time"/>
|
||||||
|
<result property="createTime" column="tool_create_time"/>
|
||||||
|
<result property="deleted" column="tool_deleted"/>
|
||||||
|
<result property="version" column="tool_version"/>
|
||||||
|
<result property="keywords" column="tool_keywords" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
|
||||||
|
<collection property="categories"
|
||||||
|
resultMap="top.fatweb.oxygen.api.mapper.tool.ToolCategoryMapper.toolCategoryMap"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="toolWithAuthor" type="tool" extends="toolMap">
|
||||||
|
<association property="author" resultMap="top.fatweb.oxygen.api.mapper.permission.UserMapper.userWithInfoMap"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="toolWithDataMap" type="tool" extends="toolWithAuthor">
|
||||||
|
<association property="base" resultMap="top.fatweb.oxygen.api.mapper.tool.ToolBaseMapper.toolBaseWithDataMap"/>
|
||||||
|
<association property="source">
|
||||||
|
<id property="id" column="tool_source_id"/>
|
||||||
|
<result property="data" column="tool_source_data"/>
|
||||||
|
<result property="createTime" column="tool_source_create_time"/>
|
||||||
|
<result property="updateTime" column="tool_source_update_time"/>
|
||||||
|
<result property="deleted" column="tool_source_deleted"/>
|
||||||
|
<result property="version" column="tool_source_version"/>
|
||||||
|
</association>
|
||||||
|
<association property="dist">
|
||||||
|
<id property="id" column="tool_dist_id"/>
|
||||||
|
<result property="data" column="tool_dist_data"/>
|
||||||
|
<result property="createTime" column="tool_dist_create_time"/>
|
||||||
|
<result property="updateTime" column="tool_dist_update_time"/>
|
||||||
|
<result property="deleted" column="tool_dist_deleted"/>
|
||||||
|
<result property="version" column="tool_dist_version"/>
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user