feat: 未进行生成配置的数据表,不允许点击代码生成

This commit is contained in:
Charles7c 2023-08-12 17:37:08 +08:00
parent 76c65463c2
commit c67a7b6ea2
4 changed files with 16 additions and 2 deletions

View File

@ -64,4 +64,10 @@ public class TableVO implements Serializable {
*/
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 是否已配置
*/
@Schema(description = "是否已配置")
private Boolean isConfiged;
}

View File

@ -80,7 +80,13 @@ public class GeneratorServiceImpl implements GeneratorService {
}
tableList.removeIf(table -> StrUtil.equalsAny(table.getTableName(), generatorProperties.getExcludeTables()));
List<TableVO> tableVOList = BeanUtil.copyToList(tableList, TableVO.class);
return PageDataVO.build(pageQuery.getPage(), pageQuery.getSize(), tableVOList);
PageDataVO<TableVO> pageDataVO = PageDataVO.build(pageQuery.getPage(), pageQuery.getSize(), tableVOList);
for (TableVO tableVO : pageDataVO.getList()) {
long count = genConfigMapper.selectCount(
Wrappers.lambdaQuery(GenConfigDO.class).eq(GenConfigDO::getTableName, tableVO.getTableName()));
tableVO.setIsConfiged(count > 0);
}
return pageDataVO;
}
@Override

View File

@ -9,6 +9,7 @@ export interface TableRecord {
engine: string;
charset: string;
createTime?: string;
isConfiged: boolean;
}
export interface TableParam {

View File

@ -78,7 +78,8 @@
<a-button
type="text"
size="small"
title="生成"
:title="record.isConfiged ? '生成' : '请先进行生成配置'"
:disabled="!record.isConfiged"
@click="handleGenerate(record.tableName)"
>
<template #icon><icon-robot-add /></template>生成