diff --git a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt
index 923a315..b91e267 100644
--- a/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt
+++ b/src/main/kotlin/top/fatweb/oxygen/api/converter/tool/ToolBaseConverter.kt
@@ -10,6 +10,7 @@ object ToolBaseConverter {
name = toolBase.name,
source = toolBase.source?.let(ToolDataConverter::toolDataToToolDataVo),
dist = toolBase.dist?.let(ToolDataConverter::toolDataToToolDataVo),
+ compiled = toolBase.compiled == 1,
createTime = toolBase.createTime,
updateTime = toolBase.updateTime,
enable = toolBase.enable == 1
@@ -20,6 +21,7 @@ object ToolBaseConverter {
name = toolBase.name,
source = ToolDataVo(id = toolBase.sourceId, data = null, createTime = null, updateTime = null),
dist = ToolDataVo(id = toolBase.distId, data = null, createTime = null, updateTime = null),
+ compiled = toolBase.compiled == 1,
createTime = toolBase.createTime,
updateTime = toolBase.updateTime,
enable = toolBase.enable == 1
diff --git a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt
index c74bc40..10a591b 100644
--- a/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt
+++ b/src/main/kotlin/top/fatweb/oxygen/api/entity/tool/ToolBase.kt
@@ -47,6 +47,15 @@ class ToolBase {
@TableField("dist_id")
var distId: Long? = null
+ /**
+ * Has compiled
+ *
+ * @author FatttSnake, fatttsnake@gmail.com
+ * @since 1.0.0
+ */
+ @TableField("compiled")
+ var compiled: Int? = null
+
/**
* Enable
*
@@ -115,6 +124,6 @@ class ToolBase {
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)"
+ return "ToolBase(id=$id, name=$name, sourceId=$sourceId, distId=$distId, compiled=$compiled, enable=$enable, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, source=$source, dist=$dist)"
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt
index 904dba7..ce921c7 100644
--- a/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt
+++ b/src/main/kotlin/top/fatweb/oxygen/api/service/tool/impl/ToolBaseServiceImpl.kt
@@ -59,19 +59,28 @@ class ToolBaseServiceImpl(
override fun update(toolBaseUpdateParam: ToolBaseUpdateParam): ToolBaseVo {
val toolBase = baseMapper.selectOne(toolBaseUpdateParam.id!!) ?: throw NoRecordFoundException()
- toolDataService.updateById(ToolData().apply {
- id = toolBase.sourceId
- data = toolBaseUpdateParam.source
- })
+ var hasCompiled: Int? = null
- toolDataService.updateById(ToolData().apply {
- id = toolBase.distId
- data = toolBaseUpdateParam.dist
- })
+ if (!toolBaseUpdateParam.source.isNullOrBlank()) {
+ toolDataService.updateById(ToolData().apply {
+ id = toolBase.sourceId
+ data = toolBaseUpdateParam.source
+ })
+ hasCompiled = 0
+ }
+
+ if (!toolBaseUpdateParam.dist.isNullOrBlank()) {
+ toolDataService.updateById(ToolData().apply {
+ id = toolBase.distId
+ data = toolBaseUpdateParam.dist
+ })
+ hasCompiled = 1
+ }
this.updateById(ToolBase().apply {
id = toolBaseUpdateParam.id
name = toolBaseUpdateParam.name
+ compiled = hasCompiled
enable = toolBaseUpdateParam.enable?.let { if (it) 1 else 0 }
})
diff --git a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt
index 4cc2f65..5c0681a 100644
--- a/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt
+++ b/src/main/kotlin/top/fatweb/oxygen/api/vo/tool/ToolBaseVo.kt
@@ -14,6 +14,8 @@ data class ToolBaseVo(
val dist: ToolDataVo?,
+ val compiled: Boolean?,
+
val enable: Boolean?,
val createTime: LocalDateTime?,
diff --git a/src/main/resources/db/migration/master/V1_0_0_240118__Add_table_'t_b_tool_data'.sql b/src/main/resources/db/migration/master/V1_0_0_240118__Add_table_'t_b_tool_data'.sql
index fc61740..f05e75a 100644
--- a/src/main/resources/db/migration/master/V1_0_0_240118__Add_table_'t_b_tool_data'.sql
+++ b/src/main/resources/db/migration/master/V1_0_0_240118__Add_table_'t_b_tool_data'.sql
@@ -2,10 +2,10 @@ 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
+ id bigint not null primary key,
+ data mediumtext 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 '工具-数据表';
\ No newline at end of file
diff --git a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql
index 4d02b98..deee8b0 100644
--- a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql
+++ b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql
@@ -6,6 +6,7 @@ create table if not exists t_b_tool_base
name varchar(20) not null comment '基板名',
source_id bigint not null comment '源码 ID',
dist_id bigint not null comment '产物 ID',
+ compiled int not null default 0 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 '修改时间',
diff --git a/src/main/resources/mapper/tool/ToolBaseMapper.xml b/src/main/resources/mapper/tool/ToolBaseMapper.xml
index 68112da..26fe0c3 100644
--- a/src/main/resources/mapper/tool/ToolBaseMapper.xml
+++ b/src/main/resources/mapper/tool/ToolBaseMapper.xml
@@ -6,6 +6,7 @@
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.compiled as tool_base_compiled,
t_b_tool_base.enable as tool_base_enable,
t_b_tool_base.create_time as tool_base_create_time,
t_b_tool_base.update_time as tool_base_update_time,
@@ -34,6 +35,7 @@
+