Add tool tables

This commit is contained in:
2024-01-16 18:09:46 +08:00
parent 705449c5b1
commit e6688ccc56
27 changed files with 597 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
package top.fatweb.oxygen.api.controller.common
class ToolController {
}

View File

@@ -0,0 +1,64 @@
package top.fatweb.oxygen.api.entity.tool
import com.baomidou.mybatisplus.annotation.*
import java.io.Serializable
/**
* Tool category intermediate entity
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableName("t_r_tool_main_category")
class RToolCategory : Serializable {
/**
* ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableId("id")
var id: Long? = null
/**
* Tool ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("tool_id")
var toolId: Long? = null
/**
* Category ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("category_id")
var categoryId: Long? = 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 "RToolCategory(id=$id, toolId=$toolId, categoryId=$categoryId, deleted=$deleted, version=$version)"
}
}

View File

@@ -0,0 +1,142 @@
package top.fatweb.oxygen.api.entity.tool
import com.baomidou.mybatisplus.annotation.*
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
/**
* Tool entity
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableName("t_b_tool_main", autoResultMap = true)
class Tool {
/**
* 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
/**
* Tool ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("tool_id")
var toolId: String? = null
/**
* Description
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("description")
var description: String? = null
/**
* Author
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("author")
var author: Long? = null
/**
* Version of tool
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("ver")
var ver: String? = null
/**
* Privately
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("privately")
var privately: Int? = null
/**
* Keyword
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("keyword", typeHandler = JacksonTypeHandler::class)
var keyword: List<String>? = null
/**
* Source code
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("source")
var source: Long? = null
/**
* Compile product
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
var dist: Long? = null
/**
* Publish
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
var publish: Int? = null
/**
* Review
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
var review: Int? = 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 "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)"
}
}

View File

@@ -0,0 +1,63 @@
package top.fatweb.oxygen.api.entity.tool
import com.baomidou.mybatisplus.annotation.*
/**
* Tool category entity
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableName("t_b_tool_category")
class ToolCategory {
/**
* 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
/**
* Enabel
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("enable")
var enable: Int? = 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 "ToolCategory(id=$id, name=$name, enable=$enable, deleted=$deleted, version=$version)"
}
}

View File

@@ -0,0 +1,36 @@
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
/**
* Tool data entity
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableName("t_b_tool_data")
class ToolData {
/**
* ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableId("id")
var id: Long? = null
/**
* Data
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("data")
var data: String? = null
override fun toString(): String {
return "ToolData(id=$id, data=$data)"
}
}

View File

@@ -9,6 +9,8 @@ import top.fatweb.oxygen.api.entity.system.EventLog
* *
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
* @see BaseMapper
* @see EventLog
*/ */
@Mapper @Mapper
interface EventLogMapper : BaseMapper<EventLog> interface EventLogMapper : BaseMapper<EventLog>

View File

@@ -9,6 +9,8 @@ import top.fatweb.oxygen.api.entity.system.SensitiveWord
* *
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
* @see BaseMapper
* @see SensitiveWord
*/ */
@Mapper @Mapper
interface SensitiveWordMapper : BaseMapper<SensitiveWord> interface SensitiveWordMapper : BaseMapper<SensitiveWord>

View File

@@ -9,6 +9,8 @@ import top.fatweb.oxygen.api.entity.system.StatisticsLog
* *
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
* @see BaseMapper
* @see StatisticsLog
*/ */
@Mapper @Mapper
interface StatisticsLogMapper : BaseMapper<StatisticsLog> interface StatisticsLogMapper : BaseMapper<StatisticsLog>

View File

@@ -0,0 +1,16 @@
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.RToolCategory
/**
* Tool category intermediate mapper
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see BaseMapper
* @see RToolCategory
*/
@Mapper
interface RToolCategoryMapper : BaseMapper<RToolCategory>

View File

@@ -0,0 +1,16 @@
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.ToolCategory
/**
* Tool category mapper
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see BaseMapper
* @see ToolCategory
*/
@Mapper
interface ToolCategoryMapper : BaseMapper<ToolCategory>

View File

@@ -0,0 +1,16 @@
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.ToolData
/**
* Tool data mapper
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see BaseMapper
* @see ToolData
*/
@Mapper
interface ToolDataMapper : BaseMapper<ToolData>

View File

@@ -0,0 +1,16 @@
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>

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.service.tool
import com.baomidou.mybatisplus.extension.service.IService
import top.fatweb.oxygen.api.entity.tool.RToolCategory
/**
* Tool category intermediate service interface
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see IService
* @see RToolCategory
*/
interface IRToolCategoryService : IService<RToolCategory>

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.service.tool
import com.baomidou.mybatisplus.extension.service.IService
import top.fatweb.oxygen.api.entity.tool.ToolCategory
/**
* Tool category service interface
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see IService
* @see ToolCategory
*/
interface IToolCategoryService : IService<ToolCategory>

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.service.tool
import com.baomidou.mybatisplus.extension.service.IService
import top.fatweb.oxygen.api.entity.tool.ToolData
/**
* Tool data service interface
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see IService
* @see ToolData
*/
interface IToolDataService : IService<ToolData>

View File

@@ -0,0 +1,14 @@
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>

View File

@@ -0,0 +1,18 @@
package top.fatweb.oxygen.api.service.tool.impl
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import top.fatweb.oxygen.api.entity.tool.RToolCategory
import top.fatweb.oxygen.api.mapper.tool.RToolCategoryMapper
import top.fatweb.oxygen.api.service.tool.IRToolCategoryService
/**
* Tool category service implement
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ServiceImpl
* @see RToolCategoryMapper
* @see RToolCategory
* @see IRToolCategoryService
*/
class RToolCategoryServiceImpl : ServiceImpl<RToolCategoryMapper, RToolCategory>(), IRToolCategoryService

View File

@@ -0,0 +1,18 @@
package top.fatweb.oxygen.api.service.tool.impl
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import top.fatweb.oxygen.api.entity.tool.ToolCategory
import top.fatweb.oxygen.api.mapper.tool.ToolCategoryMapper
import top.fatweb.oxygen.api.service.tool.IToolCategoryService
/**
* Tool category service implement
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ServiceImpl
* @see ToolCategoryMapper
* @see ToolCategory
* @see IToolCategoryService
*/
class ToolCategoryServiceImpl : ServiceImpl<ToolCategoryMapper, ToolCategory>(), IToolCategoryService

View File

@@ -0,0 +1,18 @@
package top.fatweb.oxygen.api.service.tool.impl
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import top.fatweb.oxygen.api.entity.tool.ToolData
import top.fatweb.oxygen.api.mapper.tool.ToolDataMapper
import top.fatweb.oxygen.api.service.tool.IToolDataService
/**
* Tool data service implement
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see ServiceImpl
* @see ToolDataMapper
* @see ToolData
* @see IToolDataService
*/
class ToolDataServiceImpl : ServiceImpl<ToolDataMapper, ToolData>(), IToolDataService

View File

@@ -0,0 +1,18 @@
package top.fatweb.oxygen.api.service.tool.impl
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
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
*/
class ToolServiceImpl : ServiceImpl<ToolMapper, Tool>(), IToolService

View File

@@ -0,0 +1,23 @@
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 bigint not null comment '基于',
author bigint not null comment '作者',
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 '产物',
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)
) comment '工具-主表';

View File

@@ -1,12 +0,0 @@
drop table if exists t_tools;
create table if not exists t_tools (
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 '简介',
version varchar(20) not null comment '版本',
private int not null default 0 comment '私有',
keyword varchar(500) not null comment '关键字',
category varchar(500) not null comment '类别'
)

View File

@@ -0,0 +1,13 @@
drop table if exists t_b_tool_category;
create table if not exists t_b_tool_category
(
id bigint not null primary key,
name varchar(50) not null comment '工具类别名',
enable int not null default 1 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_tool_category_name unique (name, deleted)
) comment '工具-类别表';

View File

@@ -0,0 +1,12 @@
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
) comment '中间表-工具-主表-类别';

View File

@@ -0,0 +1,11 @@
drop table if exists t_b_tool_data;
create table if not exists t_b_tool_data
(
id bigint not null primary key,
data text 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
) comment '工具-数据表';

View File

@@ -0,0 +1,16 @@
drop table if exists t_b_tool_template;
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 '产物',
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_template_unique_name unique (name, deleted)
) comment '工具-模板表'

View File

@@ -0,0 +1,14 @@
drop table if exists t_b_tool_base;
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 '产物',
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_base_unique_name unique (name, deleted)
)