fix代码生成导入表问题
This commit is contained in:
parent
75bcc57608
commit
6b5ceafcdf
@ -160,14 +160,13 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
throw new CustomException("表不能为空");
|
throw new CustomException("表不能为空");
|
||||||
}
|
}
|
||||||
string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
string userName = User.Identity.Name;
|
int result = 0;
|
||||||
|
|
||||||
foreach (var tableName in tableNames)
|
foreach (var tableName in tableNames)
|
||||||
{
|
{
|
||||||
var tabInfo = _CodeGeneraterService.GetTableInfo(dbName, tableName);
|
var tabInfo = _CodeGeneraterService.GetTableInfo(dbName, tableName);
|
||||||
if (tabInfo != null)
|
if (tabInfo != null)
|
||||||
{
|
{
|
||||||
GenTable genTable = CodeGeneratorTool.InitTable(dbName, userName, tableName, tabInfo?.Description);
|
GenTable genTable = CodeGeneratorTool.InitTable(dbName, HttpContext.GetName(), tableName, tabInfo?.Description);
|
||||||
genTable.TableId = GenTableService.ImportGenTable(genTable);
|
genTable.TableId = GenTableService.ImportGenTable(genTable);
|
||||||
|
|
||||||
if (genTable.TableId > 0)
|
if (genTable.TableId > 0)
|
||||||
@ -179,13 +178,12 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
GenTableColumnService.DeleteGenTableColumnByTableName(tableName);
|
GenTableColumnService.DeleteGenTableColumnByTableName(tableName);
|
||||||
GenTableColumnService.InsertGenTableColumn(genTableColumns);
|
GenTableColumnService.InsertGenTableColumn(genTableColumns);
|
||||||
genTable.Columns = genTableColumns;
|
genTable.Columns = genTableColumns;
|
||||||
|
result++;
|
||||||
return SUCCESS(genTable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ToResponse(ResultCode.FAIL, "生成失败");
|
return ToResponse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -215,8 +215,8 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 关闭按钮 */
|
/** 关闭按钮 */
|
||||||
close() {
|
close() {
|
||||||
this.$store.dispatch("tagsView/delView", this.$route);
|
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } };
|
||||||
this.$router.push({ path: "/tool/gen", query: { t: Date.now() } });
|
this.$tab.closeOpenPage(obj);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 排序保存
|
* 排序保存
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user