From cac74f86a004d8b31869ad4b3931284343e56991 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 07 5月 2025 11:30:37 +0800 Subject: [PATCH] 222 --- Weben_CMS专用代码生成器/Code/MainForm.cs | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" index 4742b52..097a7c0 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" @@ -81,6 +81,7 @@ //涓�閿敓鎴愭墍鏈夋枃浠� private void btn_CreateFile_Click(object sender, EventArgs e) { + var genCodeRootPath = ""; try { projectNamePrefix = this.tb_ProjectNamePrefix.Text; @@ -236,7 +237,7 @@ var str_enumList = this.tb_EnumList.Text.Trim(); if (str_enumList.IndexOf(',') > -1) { - str_enumList = str_enumList.Replace("\n",""); + str_enumList = str_enumList.Replace("\n", ""); str_enumList = str_enumList.Replace("\t", ""); str_enumList = str_enumList.Replace("\r", ""); var arr_enumList = str_enumList.Split(','); @@ -269,9 +270,10 @@ //鐢熸垚Model //CreateModelFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo); //CreateModelParamFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo); - + genCodeRootPath = tbPath.Text + @"\" + tb_WCF_NameSpacePath.Text.Trim(); + var webFolerPath = tb_WCF_NameSpacePath.Text.Trim() + "_Web"; #region 瀹炰綋绫� - var entityFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim(); + var entityFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim(); //1銆佺敓鎴� 鍒嗛〉鏌ヨ瀹炰綋 鏂囦欢 str_generate = InputQueryModel_Generate.CreateQueryModelLText(param); tf = TextHelper.Export2File_V2(entityFilePath, $"Get{param.EntityName}Input.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -305,12 +307,12 @@ #region AppSerivice //8銆佺敓鎴� IAppService 鏂囦欢 - var appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Services"; + var appServiceFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Services"; str_generate = IAppService_Generate.CreateText(param); tf = TextHelper.Export2File_V2(appServiceFilePath, $"I{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); //9銆佺敓鎴� AppService 鏂囦欢 - appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\Implements"; + appServiceFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\Implements"; str_generate = AppService_Generate.CreateText(param); tf = TextHelper.Export2File_V2(appServiceFilePath, $"{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -320,7 +322,7 @@ #region Contorller //10銆佺敓鎴� Contorller 鏂囦欢 - var continerlllePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @"\Controller"; + var continerlllePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @"\Controller"; str_generate = Controller_Generate.CreateText(param); tf = TextHelper.Export2File_V2(continerlllePath, $"{param.EntityName}Controller.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -330,7 +332,7 @@ #region Domain //11銆佺敓鎴� IRepository 鏂囦欢 - var iRepositoryPath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Domain\" + tb_EntityName.Text.Trim(); ; + var iRepositoryPath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Domain\" + tb_EntityName.Text.Trim(); ; str_generate = IRepository_Generate.CreateText(param); tf = TextHelper.Export2File_V2(iRepositoryPath, $"I{param.EntityName}Repository.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -340,7 +342,7 @@ #region EntityFrameworkCore //12銆佺敓鎴� EfCoreRepository 鏂囦欢 - var efCoreRepositoryPath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".EntityFrameworkCore\Repositories"; + var efCoreRepositoryPath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".EntityFrameworkCore\Repositories"; str_generate = EfCoreRepository_Generate.CreateText(param); tf = TextHelper.Export2File_V2(efCoreRepositoryPath, $"EfCore{param.EntityName}Repository.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -348,7 +350,7 @@ #endregion #region Web - var webRootPath = tbPath.Text + @"\web\src\widgets\" + tb_EntityName.Text.Trim(); + var webRootPath = genCodeRootPath + @"\" + webFolerPath + @"\src\widgets\" + tb_EntityName.Text.Trim(); //13銆佺敓鎴� Index 鏂囦欢 str_generate = Index_Generate.CreateText(param); @@ -455,7 +457,7 @@ //36銆佺敓鎴� AutoMapperProfile 鏂囦欢 - var autoMapFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\MapperProfiles"; + var autoMapFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\MapperProfiles"; str_generate = AutoMapperProfile_Generate.CreateText(param); tf = TextHelper.Export2File_V2(autoMapFilePath, param.EntityName + $"AutoMapperProfile.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo); @@ -524,7 +526,7 @@ } //MessageBox.Show("鐢熸垚鏂囦欢鎴愬姛锛�"); //鎴愬姛涔嬪悗鎵撳紑鏂囦欢澶� - using (System.Diagnostics.Process.Start(this.tbPath.Text)) + using (System.Diagnostics.Process.Start(genCodeRootPath)) { } -- Gitblit v1.9.3