From dcb3c55cb103ed1e3c4cf470f038e71da132ffcd 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: Sat, 5 Aug 2023 11:22:00 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E9=A2=84=E8=A7=88=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/OptionsSetting.cs | 1 + ZR.Admin.WebApi/appsettings.json | 5 ++++- ZR.CodeGenerator/CodeGeneratorTool.cs | 15 +++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Infrastructure/OptionsSetting.cs b/Infrastructure/OptionsSetting.cs index 86726f9..e451fee 100644 --- a/Infrastructure/OptionsSetting.cs +++ b/Infrastructure/OptionsSetting.cs @@ -82,6 +82,7 @@ namespace Infrastructure public class Gen { + public bool ShowApp { get; set; } public bool AutoPre { get; set; } public string VuePath { get; set; } public string Author { get; set; } diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 2a47d0f..5ba8dfb 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -63,7 +63,10 @@ }, //代码生成配置 "gen": { - "autoPre": true, //自动去除表前缀 + //是否显示移动端代码生成 + "showApp": false, + //自动去除表前缀 + "autoPre": true, "author": "admin", "tablePrefix": "sys_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)", "vuePath": "", //前端代码存储路径eg:D:\Work\ZRAdmin-Vue3 diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs index c4d1947..2466e02 100644 --- a/ZR.CodeGenerator/CodeGeneratorTool.cs +++ b/ZR.CodeGenerator/CodeGeneratorTool.cs @@ -26,11 +26,11 @@ namespace ZR.CodeGenerator /// public static void Generate(GenerateDto dto) { - var vuePath = AppSettings.GetConfig("gen:vuePath"); + var genOptions = AppSettings.Get("gen"); dto.VueParentPath = dto.VueVersion == 3 ? "ZRAdmin-vue" : "ZR.Vue"; - if (!vuePath.IsEmpty()) + if (!genOptions.VuePath.IsEmpty()) { - dto.VueParentPath = vuePath; + dto.VueParentPath = genOptions.VuePath; } dto.GenOptions = GenerateOption(dto.GenTable); if (dto.GenTable.SubTable != null) @@ -82,9 +82,12 @@ namespace ZR.CodeGenerator } GenerateVueJs(dto); GenerateSql(dto); - GenerateAppVueViews(replaceDto, dto); - GenerateAppVueFormViews(replaceDto, dto); - GenerateAppJs(dto); + if (genOptions.ShowApp) + { + GenerateAppVueViews(replaceDto, dto); + GenerateAppVueFormViews(replaceDto, dto); + GenerateAppJs(dto); + } dto.ReplaceDto = replaceDto; }