Complete core functions #9

Merged
FatttSnake merged 171 commits from FatttSnake into dev 2024-02-23 11:56:35 +08:00
7 changed files with 121 additions and 63 deletions
Showing only changes of commit 3dc935a98a - Show all commits

View File

@@ -25,6 +25,7 @@ object ToolConverter {
id = tool.id,
name = tool.name,
toolId = tool.toolId,
icon = tool.icon,
description = tool.description,
baseId = tool.baseId,
author = tool.author?.let(UserConverter::userToUserWithInfoVo),
@@ -37,6 +38,7 @@ object ToolConverter {
entryPoint = tool.entryPoint,
publish = tool.publish == 1,
review = tool.review,
publishTime = tool.publishTime,
createTime = tool.createTime,
updateTime = tool.updateTime
)

View File

@@ -51,6 +51,15 @@ class Tool {
@TableField("tool_id")
var toolId: String? = null
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("icon")
var icon: String? = null
/**
* Description
*
@@ -146,10 +155,21 @@ class Tool {
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ReviewType
*/
@TableField("review")
var review: ReviewType? = null
/**
* Publish time
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see LocalDateTime
*/
@TableField("publish_time")
var publishTime: LocalDateTime? = null
/**
* Create time
*
@@ -236,6 +256,6 @@ class Tool {
var dist: ToolData? = null
override fun toString(): String {
return "Tool(id=$id, name=$name, toolId=$toolId, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, privately=$privately, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, categories=$categories, source=$source, dist=$dist)"
return "Tool(id=$id, name=$name, toolId=$toolId, icon=$icon, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, privately=$privately, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, publishTime=$publishTime, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, base=$base, categories=$categories, source=$source, dist=$dist)"
}
}

View File

@@ -38,6 +38,16 @@ data class ToolCreateParam(
)
val toolId: String?,
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "图标", required = true)
@field: NotBlank(message = "Icon can not be blank")
val icon: String?,
/**
* Description
*

View File

@@ -62,6 +62,7 @@ class EditServiceImpl(
val tool = Tool().apply {
name = toolCreateParam.name!!.trim()
toolId = toolCreateParam.toolId
icon = toolCreateParam.icon
description = toolCreateParam.description
baseId = template.base!!.id
authorId = WebUtil.getLoginUserId() ?: throw UserNotFoundException()

View File

@@ -41,6 +41,15 @@ data class ToolVo(
@Schema(description = "工具 ID")
val toolId: String?,
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "图标")
val icon: String?,
/**
* Description
*
@@ -155,6 +164,16 @@ data class ToolVo(
@Schema(description = "审核")
val review: Tool.ReviewType?,
/**
* Publish time
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see LocalDateTime
*/
@Schema(description = "发布时间", example = "1900-01-01T00:00:00.000Z")
val publishTime: LocalDateTime?,
/**
* Create time
*

View File

@@ -2,23 +2,25 @@ drop table if exists t_b_tool_main;
create table if not exists t_b_tool_main
(
id bigint not null primary key,
name varchar(50) not null comment '工具名',
tool_id varchar(50) not null comment '工具 ID',
description varchar(500) 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 '私有',
keywords varchar(500) not null comment '关键字',
source_id bigint not null comment '源码 ID',
dist_id bigint not null comment '产物 ID',
entry_point varchar(64) not null default 'main.tsx' comment '入口文件',
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,
id bigint not null primary key,
name varchar(50) not null comment '工具名',
tool_id varchar(50) not null comment '工具 ID',
icon text not null comment '图标',
description varchar(500) 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 '私有',
keywords varchar(500) not null comment '关键字',
source_id bigint not null comment '源码 ID',
dist_id bigint not null comment '产物 ID',
entry_point varchar(64) not null default 'main.tsx' comment '入口文件',
publish int not null default 0 comment '发布',
review varchar(10) not null default 'NONE' comment '审核',
publish_time datetime 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,
constraint t_b_tool_main_unique_tool_id unique (tool_id, author_id, ver, deleted)
) comment '工具-主表';

View File

@@ -31,50 +31,52 @@
</select>
<select id="selectOne" resultMap="toolMap">
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.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.privately as tool_privately,
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
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.privately as tool_privately,
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.publish_time as tool_publish_time,
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
@@ -104,6 +106,7 @@
<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"/>
@@ -114,6 +117,7 @@
<result property="entryPoint" column="tool_entry_point"/>
<result property="publish" column="tool_publish"/>
<result property="review" column="tool_review"/>
<result property="publishTime" column="tool_publish_time"/>
<result property="updateTime" column="tool_update_time"/>
<result property="createTime" column="tool_create_time"/>
<result property="deleted" column="tool_deleted"/>