🐛 fix代码生成导入报错
This commit is contained in:
parent
9f587711f0
commit
0e043c5716
@ -153,7 +153,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
throw new CustomException("表不能为空");
|
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);
|
string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
foreach (var tableName in tableNames)
|
foreach (var tableName in tableNames)
|
||||||
@ -164,7 +164,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
List<OracleSeq> seqs = new();
|
List<OracleSeq> seqs = new();
|
||||||
GenTable genTable = CodeGeneratorTool.InitTable(dbName, HttpContext.GetName(), tableName, tabInfo?.Description);
|
GenTable genTable = CodeGeneratorTool.InitTable(dbName, HttpContext.GetName(), tableName, tabInfo?.Description);
|
||||||
genTable.TableId = GenTableService.ImportGenTable(genTable);
|
genTable.TableId = GenTableService.ImportGenTable(genTable);
|
||||||
if (dbType == 3)
|
if (dbConfig.DbType == 3)
|
||||||
{
|
{
|
||||||
seqs = _CodeGeneraterService.GetAllOracleSeqs(dbName);
|
seqs = _CodeGeneraterService.GetAllOracleSeqs(dbName);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"IsAutoCloseConnection": true
|
"IsAutoCloseConnection": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
||||||
"Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog={dbName};",
|
"Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog={dbName};",
|
||||||
"DbType": 1,
|
"DbType": 1,
|
||||||
"ConfigId": "0",
|
"ConfigId": "0",
|
||||||
|
|||||||
@ -414,9 +414,9 @@ namespace ZR.CodeGenerator
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static GenTableColumn InitColumnField(GenTable genTable, DbColumnInfo column, List<OracleSeq> seqs)
|
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;
|
var dataType = column.DataType;
|
||||||
if (dbType == 3)
|
if (dbConfig.DbType == 3)
|
||||||
{
|
{
|
||||||
dataType = column.OracleDataType;
|
dataType = column.OracleDataType;
|
||||||
var seqName = $"SEQ_{genTable.TableName}_{column.DbColumnName}";
|
var seqName = $"SEQ_{genTable.TableName}_{column.DbColumnName}";
|
||||||
|
|||||||
@ -7,7 +7,6 @@ namespace ZR.CodeGenerator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenConstants
|
public class GenConstants
|
||||||
{
|
{
|
||||||
public static string Gen_conn_dbType = "gen:dbType";
|
|
||||||
public static string Gen_author = "gen:author";
|
public static string Gen_author = "gen:author";
|
||||||
public static string Gen_autoPre = "gen:autoPre";
|
public static string Gen_autoPre = "gen:autoPre";
|
||||||
public static string Gen_tablePrefix = "gen:tablePrefix";
|
public static string Gen_tablePrefix = "gen:tablePrefix";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user