refactor: 代码配置删除由逻辑删除调整为物理删除

This commit is contained in:
ray
2024-08-01 06:59:49 +08:00
parent ea28efb586
commit 06fcb7f01b
6 changed files with 6 additions and 15 deletions

View File

@@ -444,9 +444,8 @@ CREATE TABLE `gen_config` (
`parent_menu_id` bigint DEFAULT NULL COMMENT '上级菜单ID对应sys_menu的id ',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tablename_deleted` (`table_name`,`is_deleted`) USING BTREE
UNIQUE KEY `uk_tablename_deleted` (`table_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='代码生成基础配置表';
-- ----------------------------
@@ -472,7 +471,6 @@ CREATE TABLE `gen_field_config` (
`dict_type` varchar(100) DEFAULT NULL COMMENT '字典类型(sys_dict表的code)',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime COMMENT '更新时间',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='代码生成字段配置表';

View File

@@ -445,9 +445,8 @@ CREATE TABLE `gen_config` (
`parent_menu_id` bigint DEFAULT NULL COMMENT '上级菜单ID对应sys_menu的id ',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tablename_deleted` (`table_name`,`is_deleted`) USING BTREE
UNIQUE KEY `uk_tablename` (`table_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代码生成基础配置表';
-- ----------------------------
@@ -473,7 +472,6 @@ CREATE TABLE `gen_field_config` (
`dict_type` varchar(100) DEFAULT NULL COMMENT '字典类型(sys_dict表的code)',
`create_time` datetime COMMENT '创建时间',
`update_time` datetime COMMENT '更新时间',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代码生成字段配置表';

View File

@@ -60,8 +60,8 @@ public class GeneratorController {
public Result deleteGenConfig(
@Parameter(description = "表名", example = "sys_user") @PathVariable String tableName
) {
boolean result = generatorService.deleteGenConfig(tableName);
return Result.judge(result);
generatorService.deleteGenConfig(tableName);
return Result.success();
}
@Operation(summary = "获取预览生成代码")

View File

@@ -52,8 +52,4 @@ public class GenConfig extends BaseEntity {
* 作者
*/
private String author;
@TableLogic
private Integer isDeleted;
}

View File

@@ -54,5 +54,5 @@ public interface GeneratorService {
* @param tableName 表名
* @return
*/
boolean deleteGenConfig(String tableName);
void deleteGenConfig(String tableName);
}

View File

@@ -190,7 +190,7 @@ public class GeneratorServiceImpl implements GeneratorService {
* @return
*/
@Override
public boolean deleteGenConfig(String tableName) {
public void deleteGenConfig(String tableName) {
GenConfig genConfig = genConfigService.getOne(new LambdaQueryWrapper<GenConfig>()
.eq(GenConfig::getTableName, tableName));
@@ -202,7 +202,6 @@ public class GeneratorServiceImpl implements GeneratorService {
.eq(GenFieldConfig::getConfigId, genConfig.getId())
);
}
return result;
}