移动端代码生成预览新增配置

This commit is contained in:
不做码农 2023-08-05 11:22:00 +08:00
parent 9180bb73e4
commit dcb3c55cb1
3 changed files with 14 additions and 7 deletions

View File

@ -82,6 +82,7 @@ namespace Infrastructure
public class Gen public class Gen
{ {
public bool ShowApp { get; set; }
public bool AutoPre { get; set; } public bool AutoPre { get; set; }
public string VuePath { get; set; } public string VuePath { get; set; }
public string Author { get; set; } public string Author { get; set; }

View File

@ -63,7 +63,10 @@
}, },
// //
"gen": { "gen": {
"autoPre": true, // //
"showApp": false,
//
"autoPre": true,
"author": "admin", "author": "admin",
"tablePrefix": "sys_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)", "tablePrefix": "sys_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)",
"vuePath": "", //egD:\Work\ZRAdmin-Vue3 "vuePath": "", //egD:\Work\ZRAdmin-Vue3

View File

@ -26,11 +26,11 @@ namespace ZR.CodeGenerator
/// <param name="dto"></param> /// <param name="dto"></param>
public static void Generate(GenerateDto dto) public static void Generate(GenerateDto dto)
{ {
var vuePath = AppSettings.GetConfig("gen:vuePath"); var genOptions = AppSettings.Get<Gen>("gen");
dto.VueParentPath = dto.VueVersion == 3 ? "ZRAdmin-vue" : "ZR.Vue"; 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); dto.GenOptions = GenerateOption(dto.GenTable);
if (dto.GenTable.SubTable != null) if (dto.GenTable.SubTable != null)
@ -82,9 +82,12 @@ namespace ZR.CodeGenerator
} }
GenerateVueJs(dto); GenerateVueJs(dto);
GenerateSql(dto); GenerateSql(dto);
GenerateAppVueViews(replaceDto, dto); if (genOptions.ShowApp)
GenerateAppVueFormViews(replaceDto, dto); {
GenerateAppJs(dto); GenerateAppVueViews(replaceDto, dto);
GenerateAppVueFormViews(replaceDto, dto);
GenerateAppJs(dto);
}
dto.ReplaceDto = replaceDto; dto.ReplaceDto = replaceDto;
} }