From fd67f30c7272aa0dcf4f5fc98ee8f2a7520af45b Mon Sep 17 00:00:00 2001 From: samisgod <21gh@163.com> Date: Wed, 15 Dec 2021 11:03:48 +0800 Subject: [PATCH] Fix file path and namespace --- ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplIService.txt | 2 +- ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt | 2 +- ZR.CodeGenerator/CodeGenerateOption.cs | 4 ++++ ZR.CodeGenerator/CodeGeneratorTool.cs | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplIService.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplIService.txt index c06303e..a54b4f5 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplIService.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplIService.txt @@ -1,7 +1,7 @@ using System; using ${options.ModelsNamespace}.Models; -namespace ${options.IServicsNamespace}.Business +namespace ${options.IServicsNamespace}.${options.SubNamespace} { /// /// ${genTable.FunctionName}service接口 diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt index 0b32e69..feb44f7 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplService.txt @@ -3,7 +3,7 @@ using Infrastructure.Attribute; using ${options.ModelsNamespace}.Models; using ${options.IRepositoriesNamespace}; -namespace ${options.ServicesNamespace}.Business +namespace ${options.ServicesNamespace}.${options.SubNamespace} { /// /// ${genTable.FunctionName}Service业务层处理 diff --git a/ZR.CodeGenerator/CodeGenerateOption.cs b/ZR.CodeGenerator/CodeGenerateOption.cs index a3bad7f..3c66763 100644 --- a/ZR.CodeGenerator/CodeGenerateOption.cs +++ b/ZR.CodeGenerator/CodeGenerateOption.cs @@ -13,6 +13,10 @@ namespace ZR.CodeGenerator /// public string BaseNamespace { get; set; } /// + /// 下级命名空间 + /// + public string SubNamespace { get; set; } + /// /// 数据实体命名空间 /// public string ModelsNamespace { get; set; } diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index 2e7575a..8930d26 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -28,6 +28,7 @@ namespace ZR.CodeGenerator public static void Generate(GenerateDto dto) { _option.BaseNamespace = dto.GenTable.BaseNameSpace; + _option.SubNamespace = dto.GenTable.ModuleName; _option.DtosNamespace = _option.BaseNamespace + "Model"; _option.ModelsNamespace = _option.BaseNamespace + "Model"; _option.RepositoriesNamespace = _option.BaseNamespace + "Repository";