Complete core functions #9
@@ -1,5 +0,0 @@
|
||||
package top.fatweb.oxygen.api.controller.common
|
||||
|
||||
|
||||
class ToolController {
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import top.fatweb.oxygen.api.vo.system.SensitiveWordVo
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ISettingsService
|
||||
* @see ISensitiveWordService
|
||||
*/
|
||||
@BaseController(path = ["/system/settings"], name = "系统设置", description = "系统设置相关接口")
|
||||
class SettingsController(
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package top.fatweb.oxygen.api.controller.tool
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import org.springframework.web.bind.annotation.*
|
||||
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.ToolBaseAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolBaseService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolBaseVo
|
||||
|
||||
@BaseController(path = ["/system/tool/base"], name = "工具基板管理", description = "工具基板管理相关接口")
|
||||
class BaseController(
|
||||
private val toolBaseService: IToolBaseService
|
||||
) {
|
||||
@Operation(summary = "获取单个基板")
|
||||
@GetMapping("/{id}")
|
||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolBaseVo> =
|
||||
toolBaseService.getOne(id)?.let { ResponseResult.databaseSuccess(data = it) }
|
||||
?: let { ResponseResult.databaseFail(ResponseCode.DATABASE_NO_RECORD_FOUND) }
|
||||
|
||||
@Operation(summary = "获取基板")
|
||||
@GetMapping
|
||||
fun get(): ResponseResult<List<ToolBaseVo>> =
|
||||
ResponseResult.databaseSuccess(data = toolBaseService.get())
|
||||
|
||||
@Operation(summary = "新增基板")
|
||||
@PostMapping
|
||||
fun add(@RequestBody @Valid toolBaseAddParam: ToolBaseAddParam): ResponseResult<ToolBaseVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_INSERT_SUCCESS,
|
||||
data = toolBaseService.add(toolBaseAddParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "更新基板")
|
||||
@PutMapping
|
||||
fun update(@RequestBody @Valid toolBaseUpdateParam: ToolBaseUpdateParam): ResponseResult<ToolBaseVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
||||
data = toolBaseService.update(toolBaseUpdateParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "删除基板")
|
||||
@DeleteMapping("/{id}")
|
||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||
if (toolBaseService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FILED)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package top.fatweb.oxygen.api.controller.tool
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import org.springframework.web.bind.annotation.*
|
||||
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.ToolCategoryAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolCategoryService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolCategoryVo
|
||||
|
||||
|
||||
/**
|
||||
* Tool category management controller
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@BaseController(path = ["/system/tool/category"], name = "工具类别管理", description = "工具列别管理相关接口")
|
||||
class CategoryController(
|
||||
private val toolCategoryService: IToolCategoryService
|
||||
) {
|
||||
@Operation(summary = "获取单个类别")
|
||||
@GetMapping("/{id}")
|
||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolCategoryVo> =
|
||||
toolCategoryService.getOne(id)?.let { ResponseResult.databaseSuccess(data = it) }
|
||||
?: let { ResponseResult.databaseFail(ResponseCode.DATABASE_NO_RECORD_FOUND) }
|
||||
|
||||
@Operation(summary = "获取类别")
|
||||
@GetMapping
|
||||
fun get(): ResponseResult<List<ToolCategoryVo>> =
|
||||
ResponseResult.databaseSuccess(data = toolCategoryService.get())
|
||||
|
||||
@Operation(summary = "新增类别")
|
||||
@PostMapping
|
||||
fun add(@RequestBody @Valid toolCategoryAddParam: ToolCategoryAddParam): ResponseResult<ToolCategoryVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_INSERT_SUCCESS,
|
||||
data = toolCategoryService.add(toolCategoryAddParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "更新类别")
|
||||
@PutMapping
|
||||
fun update(@RequestBody @Valid toolCategoryUpdateParam: ToolCategoryUpdateParam): ResponseResult<ToolCategoryVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
||||
data = toolCategoryService.update(toolCategoryUpdateParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "删除类别")
|
||||
@DeleteMapping("/{id}")
|
||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||
if (toolCategoryService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FILED)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package top.fatweb.oxygen.api.controller.tool
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import org.springframework.web.bind.annotation.*
|
||||
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.ToolAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
/**
|
||||
* Tool management controller
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@BaseController(path = ["/tool"], name = "工具管理", description = "工具管理相关接口")
|
||||
class EditController(
|
||||
private val toolService: IToolService
|
||||
) {
|
||||
@Operation(summary = "获取单个工具")
|
||||
@GetMapping("/{id}")
|
||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolVo> =
|
||||
toolService.getOne(id)?.let { ResponseResult.databaseSuccess(data = it) }
|
||||
?: let { ResponseResult.databaseFail(ResponseCode.DATABASE_NO_RECORD_FOUND) }
|
||||
|
||||
@Operation(summary = "获取工具")
|
||||
@GetMapping
|
||||
fun get(): ResponseResult<List<ToolVo>> =
|
||||
ResponseResult.databaseSuccess(data = toolService.get())
|
||||
|
||||
@Operation(summary = "新增工具")
|
||||
@PostMapping
|
||||
fun add(@RequestBody @Valid toolAddParam: ToolAddParam): ResponseResult<ToolVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_INSERT_SUCCESS,
|
||||
data = toolService.add(toolAddParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "更新工具")
|
||||
@PutMapping
|
||||
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
||||
data = toolService.update(toolUpdateParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "删除工具")
|
||||
@DeleteMapping("/{id}")
|
||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||
if (toolService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FILED)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package top.fatweb.oxygen.api.controller.tool
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import org.springframework.web.bind.annotation.*
|
||||
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.ToolAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
@BaseController(path = ["/system/tool"], name = "工具管理", description = "工具管理相关接口")
|
||||
class ManagementController(
|
||||
private val toolService: IToolService
|
||||
) {
|
||||
@Operation(summary = "获取单个工具")
|
||||
@GetMapping("/{id}")
|
||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolVo> =
|
||||
toolService.getOne(id)?.let { ResponseResult.databaseSuccess(data = it) }
|
||||
?: let { ResponseResult.databaseFail(ResponseCode.DATABASE_NO_RECORD_FOUND) }
|
||||
|
||||
@Operation(summary = "获取工具")
|
||||
@GetMapping
|
||||
fun get(): ResponseResult<List<ToolVo>> =
|
||||
ResponseResult.databaseSuccess(data = toolService.get())
|
||||
|
||||
@Operation(summary = "新增工具")
|
||||
@PostMapping
|
||||
fun add(@RequestBody @Valid toolAddParam: ToolAddParam): ResponseResult<ToolVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_INSERT_SUCCESS,
|
||||
data = toolService.add(toolAddParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "更新工具")
|
||||
@PutMapping
|
||||
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
||||
data = toolService.update(toolUpdateParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "删除工具")
|
||||
@DeleteMapping("/{id}")
|
||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||
if (toolService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FILED)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package top.fatweb.oxygen.api.controller.tool
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import org.springframework.web.bind.annotation.*
|
||||
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.ToolTemplateAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolTemplateUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolTemplateService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo
|
||||
|
||||
@BaseController(path = ["/system/tool/template"], name = "工具模板管理", description = "工具模板管理相关接口")
|
||||
class TemplateController(
|
||||
private val toolTemplateService: IToolTemplateService
|
||||
) {
|
||||
@Operation(summary = "获取单个模板")
|
||||
@GetMapping("/{id}")
|
||||
fun getOne(@PathVariable id: Long): ResponseResult<ToolTemplateVo> =
|
||||
toolTemplateService.getOne(id)?.let { ResponseResult.databaseSuccess(data = it) }
|
||||
?: let { ResponseResult.databaseFail(ResponseCode.DATABASE_NO_RECORD_FOUND) }
|
||||
|
||||
@Operation(summary = "获取模板")
|
||||
@GetMapping
|
||||
fun get(): ResponseResult<List<ToolTemplateVo>> =
|
||||
ResponseResult.databaseSuccess(data = toolTemplateService.get())
|
||||
|
||||
@Operation(summary = "添加模板")
|
||||
@PostMapping
|
||||
fun add(@RequestBody @Valid toolTemplateAddParam: ToolTemplateAddParam): ResponseResult<ToolTemplateVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_INSERT_SUCCESS,
|
||||
data = toolTemplateService.add(toolTemplateAddParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "更新模板")
|
||||
@PutMapping
|
||||
fun update(@RequestBody @Valid toolTemplateUpdateParam: ToolTemplateUpdateParam): ResponseResult<ToolTemplateVo> =
|
||||
ResponseResult.databaseSuccess(
|
||||
ResponseCode.DATABASE_UPDATE_SUCCESS,
|
||||
data = toolTemplateService.update(toolTemplateUpdateParam)
|
||||
)
|
||||
|
||||
@Operation(summary = "删除模板")
|
||||
@DeleteMapping("/{id}")
|
||||
fun delete(@PathVariable id: Long): ResponseResult<Nothing> =
|
||||
if (toolTemplateService.delete(id)) ResponseResult.databaseSuccess(ResponseCode.DATABASE_DELETE_SUCCESS)
|
||||
else ResponseResult.databaseFail(ResponseCode.DATABASE_DELETE_FILED)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.oxygen.api.converter.tool
|
||||
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolBase
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolBaseVo
|
||||
|
||||
object ToolBaseConverter {
|
||||
fun toolBaseToToolBaseVo(toolBase: ToolBase) = ToolBaseVo(
|
||||
id = toolBase.id,
|
||||
name = toolBase.name,
|
||||
source = toolBase.source?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
dist = toolBase.dist?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
createTime = toolBase.createTime,
|
||||
updateTime = toolBase.updateTime
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package top.fatweb.oxygen.api.converter.tool
|
||||
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolCategory
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryUpdateParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolCategoryVo
|
||||
|
||||
object ToolCategoryConverter {
|
||||
fun toolCategoryToToolCategoryVo(toolCategory: ToolCategory) = ToolCategoryVo(
|
||||
id = toolCategory.id,
|
||||
name = toolCategory.name,
|
||||
enable = toolCategory.enable == 1,
|
||||
createTime = toolCategory.createTime,
|
||||
updateTime = toolCategory.updateTime
|
||||
)
|
||||
|
||||
fun toolCategoryAddParamToToolCategory(toolCategoryAddParam: ToolCategoryAddParam) = ToolCategory().apply {
|
||||
name = toolCategoryAddParam.name
|
||||
enable = if (toolCategoryAddParam.enable) 1 else 0
|
||||
}
|
||||
|
||||
fun toolCategoryUpdateParamToToolCategory(toolCategoryUpdateParam: ToolCategoryUpdateParam) = ToolCategory().apply {
|
||||
id = toolCategoryUpdateParam.id
|
||||
name = toolCategoryUpdateParam.name
|
||||
enable = toolCategoryUpdateParam.enable?. let { if (it) 1 else 0 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package top.fatweb.oxygen.api.converter.tool
|
||||
|
||||
import top.fatweb.oxygen.api.converter.permission.UserInfoConverter
|
||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
object ToolConverter {
|
||||
fun toolToToolVo(tool: Tool) = ToolVo(
|
||||
id = tool.id,
|
||||
name = tool.name,
|
||||
toolId = tool.toolId,
|
||||
description = tool.description,
|
||||
baseId = tool.baseId,
|
||||
author = tool.author?.let(UserInfoConverter::userInfoToUserInfoVo),
|
||||
ver = tool.ver,
|
||||
privately = tool.privately == 1,
|
||||
keywords = tool.keywords,
|
||||
categories = tool.categories?.map(ToolCategoryConverter::toolCategoryToToolCategoryVo),
|
||||
source = tool.source?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
dist = tool.dist?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
publish = tool.publish == 1,
|
||||
review = tool.review,
|
||||
createTime = tool.createTime,
|
||||
updateTime = tool.updateTime
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package top.fatweb.oxygen.api.converter.tool
|
||||
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolData
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolDataVo
|
||||
|
||||
object ToolDataConverter {
|
||||
fun toolDataToToolDataVo(toolData: ToolData) = ToolDataVo(
|
||||
id = toolData.id,
|
||||
data = toolData.data,
|
||||
createTime = toolData.createTime,
|
||||
updateTime = toolData.updateTime
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package top.fatweb.oxygen.api.converter.tool
|
||||
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo
|
||||
|
||||
object ToolTemplateConverter {
|
||||
fun toolTemplateToToolTemplateVo(toolTemplate: ToolTemplate) = ToolTemplateVo(
|
||||
id = toolTemplate.id,
|
||||
name = toolTemplate.name,
|
||||
ver = toolTemplate.ver,
|
||||
baseId = toolTemplate.baseId,
|
||||
source = toolTemplate.source?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
dist = toolTemplate.dist?.let(ToolDataConverter::toolDataToToolDataVo),
|
||||
createTime = toolTemplate.createTime,
|
||||
updateTime = toolTemplate.updateTime
|
||||
)
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package top.fatweb.oxygen.api.entity.tool
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
|
||||
import top.fatweb.oxygen.api.entity.permission.UserInfo
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* Tool entity
|
||||
@@ -48,13 +50,22 @@ class Tool {
|
||||
var description: String? = null
|
||||
|
||||
/**
|
||||
* Author
|
||||
* Base ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("author")
|
||||
var author: Long? = null
|
||||
@TableField("base_id")
|
||||
var baseId: Long? = null
|
||||
|
||||
/**
|
||||
* Author ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("author_id")
|
||||
var authorId: Long? = null
|
||||
|
||||
/**
|
||||
* Version of tool
|
||||
@@ -75,30 +86,31 @@ class Tool {
|
||||
var privately: Int? = null
|
||||
|
||||
/**
|
||||
* Keyword
|
||||
* Keywords
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("keyword", typeHandler = JacksonTypeHandler::class)
|
||||
var keyword: List<String>? = null
|
||||
@TableField("keywords", typeHandler = JacksonTypeHandler::class)
|
||||
var keywords: List<String>? = null
|
||||
|
||||
/**
|
||||
* Source code
|
||||
* Source code ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("source")
|
||||
var source: Long? = null
|
||||
@TableField("source_id")
|
||||
var sourceId: Long? = null
|
||||
|
||||
/**
|
||||
* Compile product
|
||||
* Compile product ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var dist: Long? = null
|
||||
@TableField("dist_id")
|
||||
var distId: Long? = null
|
||||
|
||||
/**
|
||||
* Publish
|
||||
@@ -106,6 +118,7 @@ class Tool {
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("publish")
|
||||
var publish: Int? = null
|
||||
|
||||
/**
|
||||
@@ -114,8 +127,29 @@ class Tool {
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("review")
|
||||
var review: Int? = null
|
||||
|
||||
/**
|
||||
* Create time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("create_time", fill = FieldFill.INSERT)
|
||||
var createTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Update time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
var updateTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Deleted
|
||||
*
|
||||
@@ -136,7 +170,43 @@ class Tool {
|
||||
@Version
|
||||
var version: Int? = null
|
||||
|
||||
/**
|
||||
* Author
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var author: UserInfo? = null
|
||||
|
||||
/**
|
||||
* Categories
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var categories: List<ToolCategory>? = null
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var source: ToolData? = null
|
||||
|
||||
/**
|
||||
* Dist
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var dist: ToolData? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "Tool(id=$id, name=$name, toolId=$toolId, description=$description, author=$author, ver=$ver, privately=$privately, keyword=$keyword, source=$source, dist=$dist, publish=$publish, review=$review, deleted=$deleted, version=$version)"
|
||||
return "Tool(id=$id, name=$name, toolId=$toolId, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, privately=$privately, keywords=$keywords, sourceId=$sourceId, distId=$distId, publish=$publish, review=$review, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, categories=$categories, source=$source, dist=$dist)"
|
||||
}
|
||||
}
|
||||
111
src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt
Normal file
111
src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt
Normal file
@@ -0,0 +1,111 @@
|
||||
package top.fatweb.oxygen.api.entity.tool
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* Tool base entity
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableName("t_b_tool_base")
|
||||
class ToolBase {
|
||||
/**
|
||||
* ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableId("id")
|
||||
var id: Long? = null
|
||||
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("name")
|
||||
var name: String? = null
|
||||
|
||||
/**
|
||||
* Source ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("source_id")
|
||||
var sourceId: Long? = null
|
||||
|
||||
/**
|
||||
* Dist ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("dist_id")
|
||||
var distId: Long? = null
|
||||
|
||||
/**
|
||||
* Create time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("create_time", fill = FieldFill.INSERT)
|
||||
var createTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Update time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
var updateTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Deleted
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("deleted")
|
||||
@TableLogic
|
||||
var deleted: Long? = null
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("version")
|
||||
@Version
|
||||
var version: Int? = null
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var source: ToolData? = null
|
||||
|
||||
/**
|
||||
* Dist
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var dist: ToolData? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ToolBase(id=$id, name=$name, sourceId=$sourceId, distId=$distId, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, dist=$dist)"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package top.fatweb.oxygen.api.entity.tool
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* Tool category entity
|
||||
@@ -37,6 +38,26 @@ class ToolCategory {
|
||||
@TableField("enable")
|
||||
var enable: Int? = null
|
||||
|
||||
/**
|
||||
* Create time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("create_time", fill = FieldFill.INSERT)
|
||||
var createTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Update time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
var updateTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Deleted
|
||||
*
|
||||
@@ -58,6 +79,6 @@ class ToolCategory {
|
||||
var version: Int? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ToolCategory(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version)"
|
||||
return "ToolCategory(id=$id, name=$name, enable=$enable, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version)"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package top.fatweb.oxygen.api.entity.tool
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField
|
||||
import com.baomidou.mybatisplus.annotation.TableId
|
||||
import com.baomidou.mybatisplus.annotation.TableName
|
||||
import com.baomidou.mybatisplus.annotation.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* Tool data entity
|
||||
@@ -30,7 +29,47 @@ class ToolData {
|
||||
@TableField("data")
|
||||
var data: String? = null
|
||||
|
||||
/**
|
||||
* Create time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("create_time", fill = FieldFill.INSERT)
|
||||
var createTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Update time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
var updateTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Deleted
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("deleted")
|
||||
@TableLogic
|
||||
var deleted: Long? = null
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("version")
|
||||
@Version
|
||||
var version: Int? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ToolData(id=$id, data=$data)"
|
||||
return "ToolData(id=$id, data=$data, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package top.fatweb.oxygen.api.entity.tool
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* Tool template entity
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableName("t_b_tool_template")
|
||||
class ToolTemplate {
|
||||
/**
|
||||
* ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableId("id")
|
||||
var id: Long? = null
|
||||
|
||||
/**
|
||||
* Name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("name")
|
||||
var name: String? = null
|
||||
|
||||
/**
|
||||
* ver
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("ver")
|
||||
var ver: String? = null
|
||||
|
||||
/**
|
||||
* Base ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("base_id")
|
||||
var baseId: Long? = null
|
||||
|
||||
/**
|
||||
* Source ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("source_id")
|
||||
var sourceId: Long? = null
|
||||
|
||||
/**
|
||||
* Dist ID
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("dist_id")
|
||||
var distId: Long? = null
|
||||
|
||||
/**
|
||||
* Create time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("create_time", fill = FieldFill.INSERT)
|
||||
var createTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Update time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@TableField("update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
var updateTime: LocalDateTime? = null
|
||||
|
||||
/**
|
||||
* Deleted
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("deleted")
|
||||
@TableLogic
|
||||
var deleted: Long? = null
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField("version")
|
||||
@Version
|
||||
var version: Int? = null
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var source: ToolData? = null
|
||||
|
||||
/**
|
||||
* Dist
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
var dist: ToolData? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ToolTemplate(id=$id, name=$name, ver=$ver, baseId=$baseId, sourceId=$sourceId, distId=$distId, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package top.fatweb.oxygen.api.exception
|
||||
|
||||
class ToolHasPublish : RuntimeException("The tool has been published and cannot be modified")
|
||||
@@ -0,0 +1,21 @@
|
||||
package top.fatweb.oxygen.api.mapper.tool
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import org.apache.ibatis.annotations.Param
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolBase
|
||||
|
||||
/**
|
||||
* Tool base mapper
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see BaseMapper
|
||||
* @see ToolBase
|
||||
*/
|
||||
@Mapper
|
||||
interface ToolBaseMapper : BaseMapper<ToolBase> {
|
||||
fun selectOne(@Param("id") id: Long): ToolBase?
|
||||
|
||||
fun selectList(): List<ToolBase>
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.mapper.tool
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import org.apache.ibatis.annotations.Param
|
||||
import top.fatweb.oxygen.api.entity.tool.Tool
|
||||
|
||||
/**
|
||||
@@ -13,4 +14,8 @@ import top.fatweb.oxygen.api.entity.tool.Tool
|
||||
* @see Tool
|
||||
*/
|
||||
@Mapper
|
||||
interface ToolMapper : BaseMapper<Tool>
|
||||
interface ToolMapper : BaseMapper<Tool> {
|
||||
fun selectOne(@Param("id") id: Long): Tool?
|
||||
|
||||
fun selectList(): List<Tool>
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package top.fatweb.oxygen.api.mapper.tool
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
import org.apache.ibatis.annotations.Param
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
|
||||
/**
|
||||
* Tool template mapper
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see BaseMapper
|
||||
* @see ToolTemplate
|
||||
*/
|
||||
@Mapper
|
||||
interface ToolTemplateMapper : BaseMapper<ToolTemplate> {
|
||||
fun selectOne(@Param("id") id: Long): ToolTemplate?
|
||||
|
||||
fun selectList(): List<ToolTemplate>
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.NotEmpty
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
|
||||
data class ToolAddParam(
|
||||
@field: NotBlank(message = "Name can not be blank")
|
||||
val name: String?,
|
||||
|
||||
@field: NotBlank(message = "ToolId can not be blank")
|
||||
@field: Pattern(
|
||||
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
|
||||
message = "Ver can only match '^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$'"
|
||||
)
|
||||
val toolId: String?,
|
||||
|
||||
val description: String?,
|
||||
|
||||
@field: NotNull(message = "BaseId can not be null")
|
||||
val baseId: Long?,
|
||||
|
||||
@field: NotNull(message = "AuthorId can not be null")
|
||||
val authorId: Long?,
|
||||
|
||||
@field: NotBlank(message = "Ver can not be blank")
|
||||
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
|
||||
val ver: String?,
|
||||
|
||||
val privately: Boolean = false,
|
||||
|
||||
@field: NotEmpty(message = "Keywords can not be empty")
|
||||
val keywords: List<String>,
|
||||
|
||||
@field: NotEmpty(message = "Categories can not be empty")
|
||||
val categories: List<Long>,
|
||||
|
||||
@field: NotNull(message = "Source can not be null")
|
||||
val source: String?,
|
||||
|
||||
@field:NotNull(message = "Dist can not be null")
|
||||
val dist: String?
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.NotNull
|
||||
|
||||
data class ToolBaseAddParam(
|
||||
@field: NotBlank(message = "Name can not be blank")
|
||||
val name: String?,
|
||||
|
||||
@field: NotNull(message = "Source can not be null")
|
||||
val source: String?,
|
||||
|
||||
@field:NotNull(message = "Dist can not be null")
|
||||
val dist: String?
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotNull
|
||||
|
||||
data class ToolBaseUpdateParam(
|
||||
@field: NotNull(message = "ID can not be null")
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
val source: String?,
|
||||
|
||||
val dist: String?
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
|
||||
data class ToolCategoryAddParam(
|
||||
@field: NotBlank(message = "Name can not be blank")
|
||||
val name: String?,
|
||||
|
||||
val enable: Boolean = true
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.NotNull
|
||||
|
||||
data class ToolCategoryUpdateParam(
|
||||
@field: NotNull(message = "ID can not be null")
|
||||
val id: Long?,
|
||||
|
||||
@field: NotBlank(message = "Name can not be blank")
|
||||
val name: String?,
|
||||
|
||||
val enable: Boolean?
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
|
||||
data class ToolTemplateAddParam(
|
||||
@field: NotBlank(message = "Name can not be blank")
|
||||
val name: String?,
|
||||
|
||||
@field: NotBlank(message = "Ver can not be blank")
|
||||
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
|
||||
val ver: String?,
|
||||
|
||||
@field: NotNull(message = "BaseId can not be null")
|
||||
val baseId: Long? = null,
|
||||
|
||||
@field: NotNull(message = "Source can not be null")
|
||||
val source: String?,
|
||||
|
||||
@field:NotNull(message = "Dist can not be null")
|
||||
val dist: String?
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
|
||||
data class ToolTemplateUpdateParam(
|
||||
@field: NotNull(message = "ID can not be null")
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
|
||||
val ver: String?,
|
||||
|
||||
val baseId: Long?,
|
||||
|
||||
val source: String?,
|
||||
|
||||
val dist: String?
|
||||
)
|
||||
@@ -0,0 +1,34 @@
|
||||
package top.fatweb.oxygen.api.param.tool
|
||||
|
||||
import jakarta.validation.constraints.NotNull
|
||||
import jakarta.validation.constraints.Pattern
|
||||
|
||||
data class ToolUpdateParam(
|
||||
@field: NotNull(message = "ID can not be null")
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
@field: Pattern(
|
||||
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
|
||||
message = "Ver can only match '^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$'"
|
||||
)
|
||||
val toolId: String?,
|
||||
|
||||
val description: String?,
|
||||
|
||||
val authorId: Long?,
|
||||
|
||||
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
|
||||
val ver: String?,
|
||||
|
||||
val privately: Boolean?,
|
||||
|
||||
val keywords: List<String>,
|
||||
|
||||
val categories: List<Long>,
|
||||
|
||||
val source: String?,
|
||||
|
||||
val dist: String?
|
||||
)
|
||||
@@ -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.ToolBase
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolCategory
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseUpdateParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolBaseVo
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolCategoryVo
|
||||
|
||||
/**
|
||||
* Tool base service interface
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IService
|
||||
* @see ToolBase
|
||||
*/
|
||||
interface IToolBaseService : IService<ToolBase> {
|
||||
fun getOne(id: Long): ToolBaseVo?
|
||||
|
||||
fun get(): List<ToolBaseVo>
|
||||
|
||||
fun add(toolBaseAddParam: ToolBaseAddParam): ToolBaseVo
|
||||
|
||||
fun update(toolBaseUpdateParam: ToolBaseUpdateParam): ToolBaseVo
|
||||
|
||||
fun delete(id: Long): Boolean
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package top.fatweb.oxygen.api.service.tool
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolCategory
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryUpdateParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolCategoryVo
|
||||
|
||||
/**
|
||||
* Tool category service interface
|
||||
@@ -11,4 +14,14 @@ import top.fatweb.oxygen.api.entity.tool.ToolCategory
|
||||
* @see IService
|
||||
* @see ToolCategory
|
||||
*/
|
||||
interface IToolCategoryService : IService<ToolCategory>
|
||||
interface IToolCategoryService : IService<ToolCategory> {
|
||||
fun getOne(id: Long): ToolCategoryVo?
|
||||
|
||||
fun get(): List<ToolCategoryVo>
|
||||
|
||||
fun add(toolCategoryAddParam: ToolCategoryAddParam): ToolCategoryVo
|
||||
|
||||
fun update(toolCategoryUpdateParam: ToolCategoryUpdateParam): ToolCategoryVo
|
||||
|
||||
fun delete(id: Long): Boolean
|
||||
}
|
||||
@@ -2,6 +2,9 @@ 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.ToolAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
/**
|
||||
* Tool service interface
|
||||
@@ -11,4 +14,14 @@ import top.fatweb.oxygen.api.entity.tool.Tool
|
||||
* @see IService
|
||||
* @see Tool
|
||||
*/
|
||||
interface IToolService : IService<Tool>
|
||||
interface IToolService : IService<Tool> {
|
||||
fun getOne(id: Long): ToolVo?
|
||||
|
||||
fun get(): List<ToolVo>
|
||||
|
||||
fun add(toolAddParam: ToolAddParam): ToolVo
|
||||
|
||||
fun update(toolUpdateParam: ToolUpdateParam): ToolVo
|
||||
|
||||
fun delete(id: Long): Boolean
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package top.fatweb.oxygen.api.service.tool
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolTemplateUpdateParam
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo
|
||||
|
||||
/**
|
||||
* Tool template service interface
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IService
|
||||
* @see ToolTemplate
|
||||
*/
|
||||
interface IToolTemplateService : IService<ToolTemplate> {
|
||||
fun getOne(id: Long): ToolTemplateVo?
|
||||
|
||||
fun get(): List<ToolTemplateVo>
|
||||
|
||||
fun add(toolTemplateAddParam: ToolTemplateAddParam): ToolTemplateVo
|
||||
|
||||
fun update(toolTemplateUpdateParam: ToolTemplateUpdateParam): ToolTemplateVo
|
||||
|
||||
fun delete(id: Long): Boolean
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.RToolCategory
|
||||
import top.fatweb.oxygen.api.mapper.tool.RToolCategoryMapper
|
||||
import top.fatweb.oxygen.api.service.tool.IRToolCategoryService
|
||||
@@ -15,4 +16,5 @@ import top.fatweb.oxygen.api.service.tool.IRToolCategoryService
|
||||
* @see RToolCategory
|
||||
* @see IRToolCategoryService
|
||||
*/
|
||||
@Service
|
||||
class RToolCategoryServiceImpl : ServiceImpl<RToolCategoryMapper, RToolCategory>(), IRToolCategoryService
|
||||
@@ -0,0 +1,85 @@
|
||||
package top.fatweb.oxygen.api.service.tool.impl
|
||||
|
||||
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.ToolBaseConverter
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolBase
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolData
|
||||
import top.fatweb.oxygen.api.exception.NoRecordFoundException
|
||||
import top.fatweb.oxygen.api.mapper.tool.ToolBaseMapper
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolBaseUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolBaseService
|
||||
import top.fatweb.oxygen.api.service.tool.IToolDataService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolBaseVo
|
||||
|
||||
/**
|
||||
* Tool base service implement
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ServiceImpl
|
||||
* @see ToolBaseMapper
|
||||
* @see ToolBase
|
||||
* @see IToolBaseService
|
||||
*/
|
||||
@Service
|
||||
class ToolBaseServiceImpl(
|
||||
private val toolDataService: IToolDataService
|
||||
) : ServiceImpl<ToolBaseMapper, ToolBase>(), IToolBaseService {
|
||||
override fun getOne(id: Long): ToolBaseVo? = baseMapper.selectOne(id)?.let(ToolBaseConverter::toolBaseToToolBaseVo)
|
||||
|
||||
override fun get(): List<ToolBaseVo> = baseMapper.selectList().map(ToolBaseConverter::toolBaseToToolBaseVo)
|
||||
|
||||
@Transactional
|
||||
override fun add(toolBaseAddParam: ToolBaseAddParam): ToolBaseVo {
|
||||
val newSource = ToolData().apply { data = toolBaseAddParam.source }
|
||||
val newDist = ToolData().apply { data = toolBaseAddParam.dist }
|
||||
|
||||
toolDataService.save(newSource)
|
||||
toolDataService.save(newDist)
|
||||
|
||||
val toolBase = ToolBase().apply {
|
||||
name = toolBaseAddParam.name
|
||||
sourceId = newSource.id
|
||||
distId = newDist.id
|
||||
source = newSource
|
||||
dist = newDist
|
||||
}
|
||||
|
||||
this.save(toolBase)
|
||||
|
||||
return ToolBaseConverter.toolBaseToToolBaseVo(toolBase)
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override fun update(toolBaseUpdateParam: ToolBaseUpdateParam): ToolBaseVo {
|
||||
val toolBase = baseMapper.selectOne(toolBaseUpdateParam.id!!) ?: throw NoRecordFoundException()
|
||||
|
||||
toolDataService.updateById(ToolData().apply {
|
||||
id = toolBase.sourceId
|
||||
data = toolBaseUpdateParam.source
|
||||
})
|
||||
|
||||
toolDataService.updateById(ToolData().apply {
|
||||
id = toolBase.distId
|
||||
data = toolBaseUpdateParam.dist
|
||||
})
|
||||
|
||||
this.updateById(ToolBase().apply {
|
||||
id = toolBaseUpdateParam.id
|
||||
name = toolBaseUpdateParam.name
|
||||
})
|
||||
|
||||
return this.getOne(toolBase.id!!)!!
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override fun delete(id: Long): Boolean {
|
||||
val toolBase = this.getById(id)
|
||||
|
||||
return toolDataService.removeBatchByIds(listOf(toolBase.sourceId, toolBase.distId))
|
||||
&& this.removeById(id)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
package top.fatweb.oxygen.api.service.tool.impl
|
||||
|
||||
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.ToolCategoryConverter
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolCategory
|
||||
import top.fatweb.oxygen.api.mapper.tool.ToolCategoryMapper
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolCategoryUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolCategoryService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolCategoryVo
|
||||
|
||||
/**
|
||||
* Tool category service implement
|
||||
@@ -15,4 +21,29 @@ import top.fatweb.oxygen.api.service.tool.IToolCategoryService
|
||||
* @see ToolCategory
|
||||
* @see IToolCategoryService
|
||||
*/
|
||||
class ToolCategoryServiceImpl : ServiceImpl<ToolCategoryMapper, ToolCategory>(), IToolCategoryService
|
||||
@Service
|
||||
class ToolCategoryServiceImpl : ServiceImpl<ToolCategoryMapper, ToolCategory>(), IToolCategoryService {
|
||||
override fun getOne(id: Long): ToolCategoryVo? =
|
||||
this.getById(id)?.let(ToolCategoryConverter::toolCategoryToToolCategoryVo)
|
||||
|
||||
override fun get(): List<ToolCategoryVo> =
|
||||
this.list().map(ToolCategoryConverter::toolCategoryToToolCategoryVo)
|
||||
|
||||
override fun add(toolCategoryAddParam: ToolCategoryAddParam): ToolCategoryVo {
|
||||
val toolCategory = ToolCategoryConverter.toolCategoryAddParamToToolCategory(toolCategoryAddParam)
|
||||
|
||||
this.save(toolCategory)
|
||||
|
||||
return ToolCategoryConverter.toolCategoryToToolCategoryVo(toolCategory)
|
||||
}
|
||||
|
||||
override fun update(toolCategoryUpdateParam: ToolCategoryUpdateParam): ToolCategoryVo {
|
||||
val toolCategory = ToolCategoryConverter.toolCategoryUpdateParamToToolCategory(toolCategoryUpdateParam)
|
||||
|
||||
this.updateById(toolCategory)
|
||||
|
||||
return ToolCategoryConverter.toolCategoryToToolCategoryVo(toolCategory)
|
||||
}
|
||||
|
||||
override fun delete(id: Long): Boolean = this.removeById(id)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.ToolData
|
||||
import top.fatweb.oxygen.api.mapper.tool.ToolDataMapper
|
||||
import top.fatweb.oxygen.api.service.tool.IToolDataService
|
||||
@@ -15,4 +16,5 @@ import top.fatweb.oxygen.api.service.tool.IToolDataService
|
||||
* @see ToolData
|
||||
* @see IToolDataService
|
||||
*/
|
||||
@Service
|
||||
class ToolDataServiceImpl : ServiceImpl<ToolDataMapper, ToolData>(), IToolDataService
|
||||
@@ -1,9 +1,22 @@
|
||||
package top.fatweb.oxygen.api.service.tool.impl
|
||||
|
||||
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
|
||||
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.entity.tool.ToolData
|
||||
import top.fatweb.oxygen.api.exception.NoRecordFoundException
|
||||
import top.fatweb.oxygen.api.exception.ToolHasPublish
|
||||
import top.fatweb.oxygen.api.exception.UserNotFoundException
|
||||
import top.fatweb.oxygen.api.mapper.tool.ToolMapper
|
||||
import top.fatweb.oxygen.api.service.tool.IToolService
|
||||
import top.fatweb.oxygen.api.param.tool.ToolAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolUpdateParam
|
||||
import top.fatweb.oxygen.api.service.permission.IUserService
|
||||
import top.fatweb.oxygen.api.service.tool.*
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolVo
|
||||
|
||||
/**
|
||||
* Tool service implement
|
||||
@@ -15,4 +28,95 @@ import top.fatweb.oxygen.api.service.tool.IToolService
|
||||
* @see Tool
|
||||
* @see IToolService
|
||||
*/
|
||||
class ToolServiceImpl : ServiceImpl<ToolMapper, Tool>(), IToolService
|
||||
@Service
|
||||
class ToolServiceImpl(
|
||||
private val toolDataService: IToolDataService,
|
||||
private val toolBaseService: IToolBaseService,
|
||||
private val toolCategoryService: IToolCategoryService,
|
||||
private val rToolCategoryService: IRToolCategoryService,
|
||||
private val userService: IUserService
|
||||
) : ServiceImpl<ToolMapper, Tool>(), IToolService {
|
||||
override fun getOne(id: Long): ToolVo? = baseMapper.selectOne(id)?.let(ToolConverter::toolToToolVo)
|
||||
|
||||
override fun get(): List<ToolVo> = baseMapper.selectList().map(ToolConverter::toolToToolVo)
|
||||
|
||||
@Transactional
|
||||
override fun add(toolAddParam: ToolAddParam): ToolVo {
|
||||
toolBaseService.getOne(toolAddParam.baseId!!) ?: throw NoRecordFoundException()
|
||||
userService.getOne(toolAddParam.authorId!!) ?: throw UserNotFoundException()
|
||||
|
||||
val newSource = ToolData().apply { data = toolAddParam.source }
|
||||
val newDist = ToolData().apply { data = toolAddParam.dist }
|
||||
|
||||
toolDataService.save(newSource)
|
||||
toolDataService.save(newDist)
|
||||
|
||||
val tool = Tool().apply {
|
||||
name = toolAddParam.name
|
||||
toolId = toolAddParam.toolId
|
||||
description = toolAddParam.description
|
||||
baseId = toolAddParam.baseId
|
||||
authorId = toolAddParam.authorId
|
||||
ver = toolAddParam.ver
|
||||
privately = if (toolAddParam.privately) 1 else 0
|
||||
keywords = toolAddParam.keywords
|
||||
sourceId = newSource.id
|
||||
distId = newDist.id
|
||||
}
|
||||
|
||||
this.save(tool)
|
||||
|
||||
toolAddParam.categories.forEach {
|
||||
toolCategoryService.getById(it) ?: throw NoRecordFoundException()
|
||||
rToolCategoryService.save(RToolCategory().apply {
|
||||
toolId = tool.id
|
||||
categoryId = it
|
||||
})
|
||||
}
|
||||
|
||||
return this.getOne(tool.id!!)!!
|
||||
}
|
||||
|
||||
@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!!) ?: throw UserNotFoundException()
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package top.fatweb.oxygen.api.service.tool.impl
|
||||
|
||||
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.ToolTemplateConverter
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolData
|
||||
import top.fatweb.oxygen.api.entity.tool.ToolTemplate
|
||||
import top.fatweb.oxygen.api.exception.NoRecordFoundException
|
||||
import top.fatweb.oxygen.api.mapper.tool.ToolTemplateMapper
|
||||
import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam
|
||||
import top.fatweb.oxygen.api.param.tool.ToolTemplateUpdateParam
|
||||
import top.fatweb.oxygen.api.service.tool.IToolBaseService
|
||||
import top.fatweb.oxygen.api.service.tool.IToolDataService
|
||||
import top.fatweb.oxygen.api.service.tool.IToolTemplateService
|
||||
import top.fatweb.oxygen.api.vo.tool.ToolTemplateVo
|
||||
|
||||
/**
|
||||
* Tool template service implement
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ServiceImpl
|
||||
* @see ToolTemplateMapper
|
||||
* @see ToolTemplate
|
||||
* @see IToolTemplateService
|
||||
*/
|
||||
@Service
|
||||
class ToolTemplateServiceImpl(
|
||||
private val toolDataService: IToolDataService,
|
||||
private val toolBaseService: IToolBaseService
|
||||
) : ServiceImpl<ToolTemplateMapper, ToolTemplate>(), IToolTemplateService {
|
||||
override fun getOne(id: Long): ToolTemplateVo? =
|
||||
baseMapper.selectOne(id)?.let(ToolTemplateConverter::toolTemplateToToolTemplateVo)
|
||||
|
||||
override fun get(): List<ToolTemplateVo> =
|
||||
baseMapper.selectList().map(ToolTemplateConverter::toolTemplateToToolTemplateVo)
|
||||
|
||||
@Transactional
|
||||
override fun add(toolTemplateAddParam: ToolTemplateAddParam): ToolTemplateVo {
|
||||
toolBaseService.getOne(toolTemplateAddParam.baseId!!) ?: throw NoRecordFoundException()
|
||||
|
||||
val newSource = ToolData().apply { data = toolTemplateAddParam.source }
|
||||
val newDist = ToolData().apply { data = toolTemplateAddParam.dist }
|
||||
|
||||
toolDataService.save(newSource)
|
||||
toolDataService.save(newDist)
|
||||
|
||||
val toolTemplate = ToolTemplate().apply {
|
||||
name = toolTemplateAddParam.name
|
||||
ver = toolTemplateAddParam.ver
|
||||
baseId = toolTemplateAddParam.baseId
|
||||
sourceId = newSource.id
|
||||
distId = newDist.id
|
||||
source = newSource
|
||||
dist = newDist
|
||||
}
|
||||
|
||||
this.save(toolTemplate)
|
||||
|
||||
return ToolTemplateConverter.toolTemplateToToolTemplateVo(toolTemplate)
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override fun update(toolTemplateUpdateParam: ToolTemplateUpdateParam): ToolTemplateVo {
|
||||
val toolTemplate = baseMapper.selectOne(toolTemplateUpdateParam.id!!) ?: throw NoRecordFoundException()
|
||||
toolTemplateUpdateParam.baseId?.let { toolBaseService.getOne(it) ?: throw NoRecordFoundException() }
|
||||
|
||||
toolDataService.updateById(ToolData().apply {
|
||||
id = toolTemplate.sourceId
|
||||
data = toolTemplateUpdateParam.source
|
||||
})
|
||||
|
||||
toolDataService.updateById(ToolData().apply {
|
||||
id = toolTemplate.distId
|
||||
data = toolTemplateUpdateParam.dist
|
||||
})
|
||||
|
||||
this.updateById(ToolTemplate().apply {
|
||||
id = toolTemplateUpdateParam.id
|
||||
name = toolTemplateUpdateParam.name
|
||||
ver = toolTemplateUpdateParam.ver
|
||||
baseId = toolTemplateUpdateParam.baseId
|
||||
})
|
||||
|
||||
return this.getOne(toolTemplate.id!!)!!
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override fun delete(id: Long): Boolean {
|
||||
val toolTemplate = this.getById(id)
|
||||
|
||||
return toolDataService.removeBatchByIds(listOf(toolTemplate.sourceId, toolTemplate.distId))
|
||||
&& this.removeById(id)
|
||||
}
|
||||
}
|
||||
20
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt
Normal file
20
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package top.fatweb.oxygen.api.vo.tool
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class ToolBaseVo(
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
val source: ToolDataVo?,
|
||||
|
||||
val dist: ToolDataVo?,
|
||||
|
||||
val createTime: LocalDateTime?,
|
||||
|
||||
val updateTime: LocalDateTime?
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.fatweb.oxygen.api.vo.tool
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class ToolCategoryVo(
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
val enable: Boolean?,
|
||||
|
||||
val createTime: LocalDateTime?,
|
||||
|
||||
val updateTime: LocalDateTime?
|
||||
)
|
||||
16
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolDataVo.kt
Normal file
16
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolDataVo.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package top.fatweb.oxygen.api.vo.tool
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class ToolDataVo(
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val id: Long?,
|
||||
|
||||
val data: String?,
|
||||
|
||||
val createTime: LocalDateTime?,
|
||||
|
||||
val updateTime: LocalDateTime?
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
package top.fatweb.oxygen.api.vo.tool
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class ToolTemplateVo(
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
val ver: String?,
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val baseId: Long?,
|
||||
|
||||
val source: ToolDataVo?,
|
||||
|
||||
val dist: ToolDataVo?,
|
||||
|
||||
val createTime: LocalDateTime?,
|
||||
|
||||
val updateTime: LocalDateTime?
|
||||
)
|
||||
42
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt
Normal file
42
src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolVo.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
package top.fatweb.oxygen.api.vo.tool
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
|
||||
import top.fatweb.oxygen.api.vo.permission.base.UserInfoVo
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class ToolVo (
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val id: Long?,
|
||||
|
||||
val name: String?,
|
||||
|
||||
val toolId: String?,
|
||||
|
||||
val description: String?,
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer::class)
|
||||
val baseId: Long?,
|
||||
|
||||
val author: UserInfoVo?,
|
||||
|
||||
val ver: String?,
|
||||
|
||||
val privately: Boolean?,
|
||||
|
||||
val keywords: List<String>?,
|
||||
|
||||
val categories: List<ToolCategoryVo>?,
|
||||
|
||||
val source: ToolDataVo?,
|
||||
|
||||
val dist: ToolDataVo?,
|
||||
|
||||
val publish: Boolean?,
|
||||
|
||||
val review: Int?,
|
||||
|
||||
val createTime: LocalDateTime?,
|
||||
|
||||
val updateTime: LocalDateTime?
|
||||
)
|
||||
@@ -74,12 +74,20 @@ insert into t_s_power (id, type_id)
|
||||
(1530303, 4),
|
||||
(1540101, 4),
|
||||
(1540102, 4),
|
||||
(1540103, 4),
|
||||
(1540104, 4),
|
||||
(1540201, 4),
|
||||
(1540202, 4),
|
||||
(1540203, 4),
|
||||
(1540204, 4),
|
||||
(1540301, 4),
|
||||
(1540302, 4),
|
||||
(1540303, 4),
|
||||
(1540304, 4),
|
||||
(1540401, 4),
|
||||
(1540402, 4) as new_value
|
||||
(1540402, 4),
|
||||
(1540403, 4),
|
||||
(1540404, 4) as new_value
|
||||
on duplicate key update type_id = new_value.type_id;
|
||||
|
||||
insert into t_s_module (id, name)
|
||||
@@ -87,15 +95,15 @@ insert into t_s_module (id, name)
|
||||
on duplicate key update name = new_value.name;
|
||||
|
||||
insert into t_s_menu (id, name, url, parent_id, module_id)
|
||||
values (1990000, '系统管理', '/system', null, 1000000),
|
||||
(1010000, '用户管理', '/system/user', 1990000, 1000000),
|
||||
(1020000, '角色管理', '/system/role', 1990000, 1000000),
|
||||
(1030000, '用户组管理', '/system/group', 1990000, 1000000),
|
||||
(1040000, '权限管理', '/system/power', 1990000, 1000000),
|
||||
(1510000, '系统概况', '/system/statistics', 1990000, 1000000),
|
||||
(1520000, '日志管理', '/system/log', 1990000, 1000000),
|
||||
(1530000, '系统设置', '/system/settings', 1990000, 1000000),
|
||||
(1540000, '工具配置', '/system/tools', 1990000, 1000000) as new_value
|
||||
values (1990000, '系统管理', '^/system$', null, 1000000),
|
||||
(1010000, '用户管理', '^/system/user$', 1990000, 1000000),
|
||||
(1020000, '角色管理', '^/system/role$', 1990000, 1000000),
|
||||
(1030000, '用户组管理', '^/system/group$', 1990000, 1000000),
|
||||
(1040000, '权限管理', '^/system/power$', 1990000, 1000000),
|
||||
(1510000, '系统概况', '^/system/statistics$', 1990000, 1000000),
|
||||
(1520000, '日志管理', '^/system/log$', 1990000, 1000000),
|
||||
(1530000, '系统设置', '^/system/settings$', 1990000, 1000000),
|
||||
(1540000, '工具配置', '^/system/tools(/.*)?$', 1990000, 1000000) as new_value
|
||||
on duplicate key update name =new_value.name,
|
||||
url =new_value.url,
|
||||
parent_id =new_value.parent_id;
|
||||
@@ -162,14 +170,22 @@ insert into t_s_operation(id, name, code, func_id)
|
||||
(1530301, '基础', 'system:settings:modify:base', 1530300),
|
||||
(1530302, '邮件', 'system:settings:modify:mail', 1530300),
|
||||
(1530303, '敏感词', 'system:settings:modify:sensitive', 1530300),
|
||||
(1540101, '基板', 'system:tools:query:base', 1540100),
|
||||
(1540102, '模板', 'system:tools:query:template', 1540100),
|
||||
(1540201, '基板', 'system:tools:add:base', 1540200),
|
||||
(1540202, '模板', 'system:tools:add:template', 1540200),
|
||||
(1540301, '基板', 'system:tools:modify:base', 1540300),
|
||||
(1540302, '模板', 'system:tools:modify:template', 1540300),
|
||||
(1540401, '基板', 'system:tools:delete:base', 1540400),
|
||||
(1540402, '模板', 'system:tools:delete:template', 1540400) as new_value
|
||||
(1540101, '类别', 'system:tool:query:category', 1540100),
|
||||
(1540102, '基板', 'system:tool:query:base', 1540100),
|
||||
(1540103, '模板', 'system:tool:query:template', 1540100),
|
||||
(1540104, '工具', 'system:tool:query:tool', 1540100),
|
||||
(1540201, '类别', 'system:tool:add:category', 1540200),
|
||||
(1540202, '基板', 'system:tool:add:base', 1540200),
|
||||
(1540203, '模板', 'system:tool:add:template', 1540200),
|
||||
(1540204, '工具', 'system:tool:add:tool', 1540200),
|
||||
(1540301, '类别', 'system:tool:modify:category', 1540300),
|
||||
(1540302, '基板', 'system:tool:modify:base', 1540300),
|
||||
(1540303, '模板', 'system:tool:modify:template', 1540300),
|
||||
(1540304, '工具', 'system:tool:modify:tool', 1540300),
|
||||
(1540401, '类别', 'system:tool:delete:category', 1540400),
|
||||
(1540402, '基板', 'system:tool:delete:base', 1540400),
|
||||
(1540403, '模板', 'system:tool:delete:template', 1540400),
|
||||
(1540404, '工具', 'system:tool:delete:tool', 1540400) as new_value
|
||||
on duplicate key update name=new_value.name,
|
||||
code=new_value.code,
|
||||
func_id=new_value.func_id;
|
||||
@@ -6,18 +6,18 @@ create table if not exists t_b_tool_main
|
||||
name varchar(50) not null comment '工具名',
|
||||
tool_id varchar(50) not null comment '工具 ID',
|
||||
description varchar(500) null comment '简介',
|
||||
base bigint not null comment '基于',
|
||||
author bigint not null comment '作者',
|
||||
base_id bigint not null comment '基板 ID',
|
||||
author_id bigint not null comment '作者 ID',
|
||||
ver varchar(20) not null comment '版本',
|
||||
privately int not null default 0 comment '私有',
|
||||
keyword varchar(500) not null comment '关键字',
|
||||
source bigint null comment '源码',
|
||||
dist bigint null comment '产物',
|
||||
keywords varchar(500) not null comment '关键字',
|
||||
source_id bigint not null comment '源码 ID',
|
||||
dist_id bigint not null comment '产物 ID',
|
||||
publish int not null default 0 comment '发布',
|
||||
review varchar(10) not null default 'NONE' comment '审核',
|
||||
create_time datetime not null default (utc_timestamp()) comment '创建时间',
|
||||
update_time datetime not null default (utc_timestamp()) comment '修改时间',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0,
|
||||
constraint t_b_tool_main_unique_tool_id unique (tool_id, author, deleted)
|
||||
constraint t_b_tool_main_unique_tool_id unique (tool_id, author_id, deleted)
|
||||
) comment '工具-主表';
|
||||
@@ -2,11 +2,9 @@ drop table if exists t_r_tool_main_category;
|
||||
|
||||
create table if not exists t_r_tool_main_category
|
||||
(
|
||||
id bigint not null primary key,
|
||||
tool_id bigint not null comment '工具',
|
||||
category_id bigint not null comment '类别',
|
||||
create_time datetime not null default (utc_timestamp()) comment '创建时间',
|
||||
update_time datetime not null default (utc_timestamp()) comment '修改时间',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
id bigint not null primary key,
|
||||
tool_id bigint not null comment '工具',
|
||||
category_id bigint not null comment '类别',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
) comment '中间表-工具-主表-类别';
|
||||
@@ -5,9 +5,9 @@ create table if not exists t_b_tool_template
|
||||
id bigint not null primary key,
|
||||
name varchar(40) not null comment '模板名',
|
||||
ver varchar(20) not null comment '版本',
|
||||
base varchar(20) not null comment '基于',
|
||||
source bigint not null comment '源码',
|
||||
dist bigint not null comment '产物',
|
||||
base_id bigint not null comment '基板 ID',
|
||||
source_id bigint not null comment '源码 ID',
|
||||
dist_id bigint not null comment '产物 ID',
|
||||
create_time datetime not null default (utc_timestamp()) comment '创建时间',
|
||||
update_time datetime not null default (utc_timestamp()) comment '修改时间',
|
||||
deleted bigint not null default 0,
|
||||
|
||||
@@ -4,8 +4,8 @@ create table if not exists t_b_tool_base
|
||||
(
|
||||
id bigint not null primary key,
|
||||
name varchar(20) not null comment '基板名',
|
||||
source bigint not null comment '源码',
|
||||
dist bigint not null comment '产物',
|
||||
source_id bigint not null comment '源码 ID',
|
||||
dist_id bigint not null comment '产物 ID',
|
||||
create_time datetime not null default (utc_timestamp()) comment '创建时间',
|
||||
update_time datetime not null default (utc_timestamp()) comment '修改时间',
|
||||
deleted bigint not null default 0,
|
||||
|
||||
82
src/main/resources/mapper/tool/ToolBaseMapper.xml
Normal file
82
src/main/resources/mapper/tool/ToolBaseMapper.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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.ToolBaseMapper">
|
||||
<select id="selectOne" resultMap="toolBaseMap">
|
||||
select t_b_tool_base.id as tool_base_id,
|
||||
t_b_tool_base.name as tool_base_name,
|
||||
t_b_tool_base.source_id as tool_base_source_id,
|
||||
t_b_tool_base.dist_id as tool_base_dist_id,
|
||||
t_b_tool_base.create_time as tool_base_create_time,
|
||||
t_b_tool_base.update_time as tool_base_update_time,
|
||||
t_b_tool_base.deleted as tool_base_deleted,
|
||||
t_b_tool_base.version as tool_base_version,
|
||||
tbtds.data as tool_base_source_data,
|
||||
tbtds.create_time as tool_base_source_create_time,
|
||||
tbtds.update_time as tool_base_source_update_time,
|
||||
tbtds.deleted as tool_base_source_delete,
|
||||
tbtds.version as tool_base_source_version,
|
||||
tbtdd.data as tool_base_dist_data,
|
||||
tbtdd.create_time as tool_base_dist_create_time,
|
||||
tbtdd.update_time as tool_base_dist_update_time,
|
||||
tbtdd.deleted as tool_base_dist_delete,
|
||||
tbtdd.version as tool_base_dist_version
|
||||
from t_b_tool_base
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtds
|
||||
on tbtds.id = t_b_tool_base.source_id
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtdd on tbtdd.id = t_b_tool_base.dist_id
|
||||
where t_b_tool_base.deleted = 0
|
||||
and t_b_tool_base.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultMap="toolBaseMap">
|
||||
select t_b_tool_base.id as tool_base_id,
|
||||
t_b_tool_base.name as tool_base_name,
|
||||
t_b_tool_base.source_id as tool_base_source_id,
|
||||
t_b_tool_base.dist_id as tool_base_dist_id,
|
||||
t_b_tool_base.create_time as tool_base_create_time,
|
||||
t_b_tool_base.update_time as tool_base_update_time,
|
||||
t_b_tool_base.deleted as tool_base_deleted,
|
||||
t_b_tool_base.version as tool_base_version,
|
||||
tbtds.data as tool_base_source_data,
|
||||
tbtds.create_time as tool_base_source_create_time,
|
||||
tbtds.update_time as tool_base_source_update_time,
|
||||
tbtds.deleted as tool_base_source_delete,
|
||||
tbtds.version as tool_base_source_version,
|
||||
tbtdd.data as tool_base_dist_data,
|
||||
tbtdd.create_time as tool_base_dist_create_time,
|
||||
tbtdd.update_time as tool_base_dist_update_time,
|
||||
tbtdd.deleted as tool_base_dist_delete,
|
||||
tbtdd.version as tool_base_dist_version
|
||||
from t_b_tool_base
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtds on tbtds.id = t_b_tool_base.source_id
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtdd on tbtdd.id = t_b_tool_base.dist_id
|
||||
where t_b_tool_base.deleted = 0
|
||||
</select>
|
||||
|
||||
<resultMap id="toolBaseMap" type="toolBase">
|
||||
<id property="id" column="tool_base_id"/>
|
||||
<result property="name" column="tool_base_name"/>
|
||||
<result property="sourceId" column="tool_base_source_id"/>
|
||||
<result property="distId" column="tool_base_dist_id"/>
|
||||
<result property="createTime" column="tool_base_create_time"/>
|
||||
<result property="updateTime" column="tool_base_update_time"/>
|
||||
<result property="deleted" column="tool_base_deleted"/>
|
||||
<result property="version" column="tool_base_version"/>
|
||||
<association property="source">
|
||||
<id property="id" column="tool_base_source_id"/>
|
||||
<result property="data" column="tool_base_source_data"/>
|
||||
<result property="createTime" column="tool_base_source_create_time"/>
|
||||
<result property="updateTime" column="tool_base_source_update_time"/>
|
||||
<result property="deleted" column="tool_base_source_deleted"/>
|
||||
<result property="version" column="tool_base_source_version"/>
|
||||
</association>
|
||||
<association property="dist">
|
||||
<id property="id" column="tool_base_dist_id"/>
|
||||
<result property="data" column="tool_base_dist_data"/>
|
||||
<result property="createTime" column="tool_base_dist_create_time"/>
|
||||
<result property="updateTime" column="tool_base_dist_update_time"/>
|
||||
<result property="deleted" column="tool_base_dist_deleted"/>
|
||||
<result property="version" column="tool_base_dist_version"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
12
src/main/resources/mapper/tool/ToolDataMapper.xml
Normal file
12
src/main/resources/mapper/tool/ToolDataMapper.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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.ToolDataMapper">
|
||||
<resultMap id="toolDataMap" type="toolData">
|
||||
<id property="id" column="tool_data_id"/>
|
||||
<result property="data" column="tool_data_data"/>
|
||||
<result property="createTime" column="tool_data_create_time"/>
|
||||
<result property="updateTime" column="tool_data_update_time"/>
|
||||
<result property="deleted" column="tool_data_deleted"/>
|
||||
<result property="version" column="tool_data_version"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
91
src/main/resources/mapper/tool/ToolTemplateMapper.xml
Normal file
91
src/main/resources/mapper/tool/ToolTemplateMapper.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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.ToolTemplateMapper">
|
||||
<select id="selectOne" resultMap="toolTemplateMap">
|
||||
select t_b_tool_template.id as tool_template_id,
|
||||
t_b_tool_template.name as tool_template_name,
|
||||
t_b_tool_template.ver as tool_template_ver,
|
||||
t_b_tool_template.base_id as tool_template_base_id,
|
||||
t_b_tool_template.source_id as tool_template_source_id,
|
||||
t_b_tool_template.dist_id as tool_template_dist_id,
|
||||
t_b_tool_template.create_time as tool_template_create_time,
|
||||
t_b_tool_template.update_time as tool_template_update_time,
|
||||
t_b_tool_template.deleted as tool_template_deleted,
|
||||
t_b_tool_template.version as tool_template_version,
|
||||
tbtds.data as tool_template_source_data,
|
||||
tbtds.create_time as tool_template_source_create_time,
|
||||
tbtds.update_time as tool_template_source_update_time,
|
||||
tbtds.deleted as tool_template_source_delete,
|
||||
tbtds.version as tool_template_source_version,
|
||||
tbtdd.data as tool_template_dist_data,
|
||||
tbtdd.create_time as tool_template_dist_create_time,
|
||||
tbtdd.update_time as tool_template_dist_update_time,
|
||||
tbtdd.deleted as tool_template_dist_delete,
|
||||
tbtdd.version as tool_template_dist_version
|
||||
from t_b_tool_template
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtds
|
||||
on tbtds.id = t_b_tool_template.source_id
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtdd
|
||||
on tbtdd.id = t_b_tool_template.dist_id
|
||||
where t_b_tool_template.deleted = 0
|
||||
and t_b_tool_template.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectList" resultMap="toolTemplateMap">
|
||||
select t_b_tool_template.id as tool_template_id,
|
||||
t_b_tool_template.name as tool_template_name,
|
||||
t_b_tool_template.ver as tool_template_ver,
|
||||
t_b_tool_template.base_id as tool_template_base_id,
|
||||
t_b_tool_template.source_id as tool_template_source_id,
|
||||
t_b_tool_template.dist_id as tool_template_dist_id,
|
||||
t_b_tool_template.create_time as tool_template_create_time,
|
||||
t_b_tool_template.update_time as tool_template_update_time,
|
||||
t_b_tool_template.deleted as tool_template_deleted,
|
||||
t_b_tool_template.version as tool_template_version,
|
||||
tbtds.data as tool_template_source_data,
|
||||
tbtds.create_time as tool_template_source_create_time,
|
||||
tbtds.update_time as tool_template_source_update_time,
|
||||
tbtds.deleted as tool_template_source_delete,
|
||||
tbtds.version as tool_template_source_version,
|
||||
tbtdd.data as tool_template_dist_data,
|
||||
tbtdd.create_time as tool_template_dist_create_time,
|
||||
tbtdd.update_time as tool_template_dist_update_time,
|
||||
tbtdd.deleted as tool_template_dist_delete,
|
||||
tbtdd.version as tool_template_dist_version
|
||||
from t_b_tool_template
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtds
|
||||
on tbtds.id = t_b_tool_template.source_id
|
||||
left join (select * from t_b_tool_data where deleted = 0) as tbtdd
|
||||
on tbtdd.id = t_b_tool_template.dist_id
|
||||
where t_b_tool_template.deleted = 0
|
||||
</select>
|
||||
|
||||
<resultMap id="toolTemplateMap" type="toolTemplate">
|
||||
<id property="id" column="tool_template_id"/>
|
||||
<result property="name" column="tool_template_name"/>
|
||||
<result property="ver" column="tool_template_ver"/>
|
||||
<result property="baseId" column="tool_template_base_id"/>
|
||||
<result property="sourceId" column="tool_template_source_id"/>
|
||||
<result property="distId" column="tool_template_dist_id"/>
|
||||
<result property="createTime" column="tool_template_create_time"/>
|
||||
<result property="updateTime" column="tool_template_update_time"/>
|
||||
<result property="deleted" column="tool_template_deleted"/>
|
||||
<result property="version" column="tool_template_version"/>
|
||||
<association property="source">
|
||||
<id property="id" column="tool_template_source_id"/>
|
||||
<result property="data" column="tool_template_source_data"/>
|
||||
<result property="createTime" column="tool_template_source_create_time"/>
|
||||
<result property="updateTime" column="tool_template_source_update_time"/>
|
||||
<result property="deleted" column="tool_template_source_deleted"/>
|
||||
<result property="version" column="tool_template_source_version"/>
|
||||
</association>
|
||||
<association property="dist">
|
||||
<id property="id" column="tool_template_dist_id"/>
|
||||
<result property="data" column="tool_template_dist_data"/>
|
||||
<result property="createTime" column="tool_template_dist_create_time"/>
|
||||
<result property="updateTime" column="tool_template_dist_update_time"/>
|
||||
<result property="deleted" column="tool_template_dist_deleted"/>
|
||||
<result property="version" column="tool_template_dist_version"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user