🐛 fix代码生成导入报错

This commit is contained in:
不做码农
2023-06-16 19:35:34 +08:00
parent 9f587711f0
commit 0e043c5716
4 changed files with 6 additions and 6 deletions

View File

@@ -153,7 +153,7 @@ namespace ZR.Admin.WebApi.Controllers
{
throw new CustomException("表不能为空");
}
var dbType = AppSettings.GetAppConfig(GenConstants.Gen_conn_dbType, 0);
var dbConfig = AppSettings.Get<List<DbConfigs>>("dbConfigs").FirstOrDefault(f => f.IsGenerateDb);
string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries);
int result = 0;
foreach (var tableName in tableNames)
@@ -164,7 +164,7 @@ namespace ZR.Admin.WebApi.Controllers
List<OracleSeq> seqs = new();
GenTable genTable = CodeGeneratorTool.InitTable(dbName, HttpContext.GetName(), tableName, tabInfo?.Description);
genTable.TableId = GenTableService.ImportGenTable(genTable);
if (dbType == 3)
if (dbConfig.DbType == 3)
{
seqs = _CodeGeneraterService.GetAllOracleSeqs(dbName);
}

View File

@@ -14,11 +14,12 @@
"IsAutoCloseConnection": true
},
{
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
"Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog={dbName};",
"DbType": 1,
"ConfigId": "0",
"IsAutoCloseConnection": true,
"DbName": "ZrAdmin",//代码生成默认连接数据库
"DbName": "ZrAdmin", //代码生成默认连接数据库
"IsGenerateDb": true //是否代码生成使用库,不要改动
}
//...下面添加更多的数据库源