From 387d69a8f2a3ee93d4332e9ebee8bbaede76e7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Mon, 9 May 2022 18:55:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt | 2 +- ZR.CodeGenerator/CodeGeneratorTool.cs | 2 +- ZR.Service/System/GenTableService.cs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt index 219b23b..927cb2b 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt @@ -53,7 +53,7 @@ $end $end var response = _${replaceDto.ModelTypeName}Repository .Queryable() -$if(genTable.SubTableName != "" && genTable.SubTableName != null) +$if(null != genTable.SubTableName && "" != genTable.SubTableName) .Includes(it => it.Sub.MappingField(z => z.${genTable.SubTableFkName}, () => it.${replaceDto.PKName})) $end $if(genTable.SortField != "" && genTable.SortField != null) diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index 23d6b76..cbf5690 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -513,7 +513,7 @@ namespace ZR.CodeGenerator /// private static void InitJntTemplate(GenerateDto dto, ReplaceDto replaceDto) { - //Engine.Current.Clean(); + Engine.Current.Clean(); dto.GenTable.Columns = dto.GenTable.Columns.OrderBy(x => x.Sort).ToList(); bool showCustomInput = dto.GenTable.Columns.Any(f => f.HtmlType.Equals(GenConstants.HTML_CUSTOM_INPUT, StringComparison.OrdinalIgnoreCase)); //jnt模板引擎全局变量 diff --git a/ZR.Service/System/GenTableService.cs b/ZR.Service/System/GenTableService.cs index a9fbe81..b6d2051 100644 --- a/ZR.Service/System/GenTableService.cs +++ b/ZR.Service/System/GenTableService.cs @@ -60,7 +60,10 @@ namespace ZR.Service.System if (info != null && !info.SubTableName.IsEmpty()) { info.SubTable = GenTableRepository.Queryable().Where(f => f.SubTableName == info.TableName).First(); - SetTableFromOptions(info?.SubTable); + if (info?.SubTable != null) + { + SetTableFromOptions(info?.SubTable); + } } return info; }