schangxiang@126.com
2025-05-07 44d277ec414a9223619730646f99ec16df78a451
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/MainForm.cs
@@ -8,6 +8,7 @@
using GenerateCode_WeiBen_WMS.DataBaseFactory;
using GenerateCode_WeiBen_WMS.Const;
using GenerateCode_WeiBen_WMS.Model;
using GenerateCode_WeiBen_WMS.Utility;
namespace GenerateCode_GEBrilliantFactory
{
@@ -81,6 +82,7 @@
        //一键生成所有文件
        private void btn_CreateFile_Click(object sender, EventArgs e)
        {
            var genCodeRootPath = "";
            try
            {
                projectNamePrefix = this.tb_ProjectNamePrefix.Text;
@@ -236,7 +238,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 +271,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").ToLower();
                #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 +308,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 +323,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 +333,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 +343,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 +351,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,10 +458,13 @@
                //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);
                //37、生成 å¯¼å‡ºæ¨¡æ¿Excel文件
                List<ColumnModel> newColumnNameList = ListHelper.RemoveForPageTableListQueryAttributes(param.ColumnNameList);
                ImportTemplteHelper.CreateImportTemplte(param, newColumnNameList, genCodeRootPath);
                ////生成 OutputModel æ–‡ä»¶
@@ -524,7 +530,7 @@
            }
            //MessageBox.Show("生成文件成功!");
            //成功之后打开文件夹
            using (System.Diagnostics.Process.Start(this.tbPath.Text))
            using (System.Diagnostics.Process.Start(genCodeRootPath))
            {
            }