🐛 fix代码生成导入报错
This commit is contained in:
parent
9f587711f0
commit
0e043c5716
@ -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);
|
||||
}
|
||||
|
||||
@ -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 //是否代码生成使用库,不要改动
|
||||
}
|
||||
//...下面添加更多的数据库源
|
||||
|
||||
@ -414,9 +414,9 @@ namespace ZR.CodeGenerator
|
||||
/// <returns></returns>
|
||||
private static GenTableColumn InitColumnField(GenTable genTable, DbColumnInfo column, List<OracleSeq> seqs)
|
||||
{
|
||||
var dbType = AppSettings.Get<int>(GenConstants.Gen_conn_dbType);
|
||||
var dbConfig = AppSettings.Get<List<DbConfigs>>("dbConfigs").FirstOrDefault(f => f.IsGenerateDb);
|
||||
var dataType = column.DataType;
|
||||
if (dbType == 3)
|
||||
if (dbConfig.DbType == 3)
|
||||
{
|
||||
dataType = column.OracleDataType;
|
||||
var seqName = $"SEQ_{genTable.TableName}_{column.DbColumnName}";
|
||||
|
||||
@ -7,7 +7,6 @@ namespace ZR.CodeGenerator
|
||||
/// </summary>
|
||||
public class GenConstants
|
||||
{
|
||||
public static string Gen_conn_dbType = "gen:dbType";
|
||||
public static string Gen_author = "gen:author";
|
||||
public static string Gen_autoPre = "gen:autoPre";
|
||||
public static string Gen_tablePrefix = "gen:tablePrefix";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user