fix代码生成导入表问题

This commit is contained in:
不做码农 2022-04-10 11:13:29 +08:00
parent 75bcc57608
commit 6b5ceafcdf
2 changed files with 6 additions and 8 deletions

View File

@ -160,14 +160,13 @@ namespace ZR.Admin.WebApi.Controllers
throw new CustomException("表不能为空");
}
string[] tableNames = tables.Split(',', StringSplitOptions.RemoveEmptyEntries);
string userName = User.Identity.Name;
int result = 0;
foreach (var tableName in tableNames)
{
var tabInfo = _CodeGeneraterService.GetTableInfo(dbName, tableName);
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);
if (genTable.TableId > 0)
@ -179,13 +178,12 @@ namespace ZR.Admin.WebApi.Controllers
GenTableColumnService.DeleteGenTableColumnByTableName(tableName);
GenTableColumnService.InsertGenTableColumn(genTableColumns);
genTable.Columns = genTableColumns;
return SUCCESS(genTable);
result++;
}
}
}
return ToResponse(ResultCode.FAIL, "生成失败");
return ToResponse(result);
}
/// <summary>

View File

@ -215,8 +215,8 @@ export default {
},
/** 关闭按钮 */
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/tool/gen", query: { t: Date.now() } });
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: this.$route.query.pageNum } };
this.$tab.closeOpenPage(obj);
},
/**
* 排序保存