mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-12 09:11:53 +08:00
增加 Oracle Driver
This commit is contained in:
@@ -50,15 +50,17 @@ public class CodegenController {
|
||||
@GetMapping("/db/table/list")
|
||||
@ApiOperation(value = "获得数据库自带的表定义列表", notes = "会过滤掉已经导入 Codegen 的表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "tableName", value = "表名,模糊匹配", required = true, example = "yudao", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "tableComment", value = "描述,模糊匹配", required = true, example = "芋道", dataTypeClass = String.class)
|
||||
@ApiImplicitParam(name = "dataSourceConfigId", value = "数据源配置的编号", required = true, example = "1", dataTypeClass = Long.class),
|
||||
@ApiImplicitParam(name = "tableName", value = "表名,模糊匹配", example = "yudao", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "tableComment", value = "描述,模糊匹配", example = "芋道", dataTypeClass = String.class)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('infra:codegen:query')")
|
||||
public CommonResult<List<SchemaTableRespVO>> getSchemaTableList(
|
||||
@RequestParam(value = "dataSourceConfigId") Long dataSourceConfigId,
|
||||
@RequestParam(value = "tableName", required = false) String tableName,
|
||||
@RequestParam(value = "tableComment", required = false) String tableComment) {
|
||||
// 获得数据库自带的表定义列表
|
||||
List<DatabaseTableDO> schemaTables = codegenService.getSchemaTableList(tableName, tableComment);
|
||||
List<DatabaseTableDO> schemaTables = codegenService.getSchemaTableList(dataSourceConfigId, tableName, tableComment);
|
||||
// 移除在 Codegen 中,已经存在的
|
||||
Set<String> existsTables = CollectionUtils.convertSet(codegenService.getCodeGenTableList(), CodegenTableDO::getTableName);
|
||||
schemaTables.removeIf(table -> existsTables.contains(table.getTableName()));
|
||||
|
@@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class ConfigPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "参数名称", example = "模糊匹配")
|
||||
@ApiModelProperty(value = "数据源名称", example = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "参数键名", example = "yunai.db.username", notes = "模糊匹配")
|
||||
|
@@ -12,8 +12,8 @@ import javax.validation.constraints.*;
|
||||
@Data
|
||||
public class DataSourceConfigBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "参数名称", required = true, example = "test")
|
||||
@NotNull(message = "参数名称不能为空")
|
||||
@ApiModelProperty(value = "数据源名称", required = true, example = "test")
|
||||
@NotNull(message = "数据源名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "数据源连接", required = true, example = "jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro")
|
||||
|
@@ -115,10 +115,12 @@ public interface CodegenService {
|
||||
/**
|
||||
* 获得数据库自带的表定义列表
|
||||
*
|
||||
*
|
||||
* @param dataSourceConfigId
|
||||
* @param tableName 表名称
|
||||
* @param tableComment 表描述
|
||||
* @return 表定义列表
|
||||
*/
|
||||
List<DatabaseTableDO> getSchemaTableList(String tableName, String tableComment);
|
||||
List<DatabaseTableDO> getSchemaTableList(Long dataSourceConfigId, String tableName, String tableComment);
|
||||
|
||||
}
|
||||
|
@@ -57,9 +57,6 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
@Resource
|
||||
private CodegenEngine codegenEngine;
|
||||
|
||||
@Resource
|
||||
private CodegenProperties codegenProperties;
|
||||
|
||||
private Long createCodegen0(Long userId, CodegenImportTypeEnum importType,
|
||||
DatabaseTableDO schemaTable, List<DatabaseColumnDO> schemaColumns) {
|
||||
// 校验导入的表和字段非空
|
||||
@@ -103,8 +100,6 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
|
||||
@Override
|
||||
public Long createCodegen(Long userId, String tableName) {
|
||||
// 获取当前schema
|
||||
String tableSchema = codegenProperties.getDbSchemas().iterator().next();
|
||||
// 从数据库中,获得数据库表结构
|
||||
DatabaseTableDO schemaTable = databaseTableService.getTable(0L, tableName);
|
||||
List<DatabaseColumnDO> schemaColumns = databaseTableService.getColumnList(0L, tableName);
|
||||
@@ -252,8 +247,8 @@ public class CodegenServiceImpl implements CodegenService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DatabaseTableDO> getSchemaTableList(String tableName, String tableComment) {
|
||||
List<DatabaseTableDO> tables = databaseTableService.getTableList(0L, tableName, tableComment);
|
||||
public List<DatabaseTableDO> getSchemaTableList(Long dataSourceConfigId, String tableName, String tableComment) {
|
||||
List<DatabaseTableDO> tables = databaseTableService.getTableList(dataSourceConfigId, tableName, tableComment);
|
||||
// TODO 强制移除 Quartz 的表,未来做成可配置
|
||||
tables.removeIf(table -> table.getTableName().startsWith("QRTZ_"));
|
||||
tables.removeIf(table -> table.getTableName().startsWith("ACT_"));
|
||||
|
Reference in New Issue
Block a user