fix 生成代码提示错误

This commit is contained in:
不做码农 2021-11-18 10:10:04 +08:00
parent 4b64ffda39
commit 0197c238eb

View File

@ -90,8 +90,11 @@ namespace ZR.Admin.WebApi.Controllers
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId); var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
genTableInfo.Columns = GenTableColumnService.GenTableColumns(dto.TableId); genTableInfo.Columns = GenTableColumnService.GenTableColumns(dto.TableId);
Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(genTableInfo.Options); if (!string.IsNullOrEmpty(genTableInfo.Options))
dto.ParentMenuId = (long)options.GetValueOrDefault("parentMenuId", 0); {
Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(genTableInfo.Options);
dto.ParentMenuId = (long)options.GetValueOrDefault("parentMenuId", 0);
}
dto.GenTable = genTableInfo; dto.GenTable = genTableInfo;
//生成代码 //生成代码
CodeGeneratorTool.Generate(genTableInfo, dto); CodeGeneratorTool.Generate(genTableInfo, dto);
@ -176,9 +179,9 @@ namespace ZR.Admin.WebApi.Controllers
ClassName = CodeGeneratorTool.GetClassName(tableName), ClassName = CodeGeneratorTool.GetClassName(tableName),
BusinessName = CodeGeneratorTool.GetClassName(tableName), BusinessName = CodeGeneratorTool.GetClassName(tableName),
FunctionAuthor = ConfigUtils.Instance.GetConfig(GenConstants.Gen_author), FunctionAuthor = ConfigUtils.Instance.GetConfig(GenConstants.Gen_author),
FunctionName = tabInfo.Description, FunctionName = string.IsNullOrEmpty(tabInfo.Description) ? tableName : tabInfo.Description,
TableName = tableName, TableName = tableName,
TableComment = tabInfo.Description, TableComment = string.IsNullOrEmpty(tabInfo.Description) ? tableName : tabInfo.Description,
Create_by = userName, Create_by = userName,
}; };
genTable.TableId = GenTableService.ImportGenTable(genTable); genTable.TableId = GenTableService.ImportGenTable(genTable);