From 0eeea319afd6c7ccb76e09fd2fb4fbf226c820a3 Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周四, 08 5月 2025 08:52:24 +0800 Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo --- Weben_CMS专用代码生成器/Code/MainForm.cs | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 129 insertions(+), 1 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 e0fe64c..8f187c0 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" @@ -8,6 +8,8 @@ using GenerateCode_WeiBen_WMS.DataBaseFactory; using GenerateCode_WeiBen_WMS.Const; using GenerateCode_WeiBen_WMS.Model; +using GenerateCode_WeiBen_WMS.Utility; +using System.Xml; namespace GenerateCode_GEBrilliantFactory { @@ -270,7 +272,7 @@ //鐢熸垚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(); + genCodeRootPath = tbPath.Text + @"\" + tb_WCF_NameSpacePath.Text.Trim(); var webFolerPath = (tb_WCF_NameSpacePath.Text.Trim() + "_Web").ToLower(); #region 瀹炰綋绫� var entityFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim(); @@ -461,6 +463,9 @@ 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 鏂囦欢 @@ -681,5 +686,128 @@ dataBaseEnum = (DataBaseEnum)Enum.Parse(typeof(DataBaseEnum), name); } + + private void btn_SelectFile_Click(object sender, EventArgs e) + { + OpenFileDialog fileDialog = new OpenFileDialog(); + fileDialog.Multiselect = true; + fileDialog.Title = "璇烽�夋嫨鏂囦欢"; + fileDialog.Filter = "鎵�鏈夋枃浠�(*txt*)|*.txt*"; //璁剧疆瑕侀�夋嫨鐨勬枃浠剁殑绫诲瀷 + if (fileDialog.ShowDialog() == DialogResult.OK) + { + string file = fileDialog.FileName;//杩斿洖鏂囦欢鐨勫畬鏁磋矾寰� + this.tb_FilePath.Text = file; + } + } + + private void tb_FilePath_TextChanged(object sender, EventArgs e) + { + try + { + string filePath = this.tb_FilePath.Text; + + string[] lines = File.ReadAllLines(filePath); + + // 鍒涘缓瀹炰綋绫诲璞� + GenerateCodeConfigParam entity = new GenerateCodeConfigParam(); + + // 瑙f瀽姣忎竴琛屽唴瀹瑰苟璧嬪�肩粰瀹炰綋绫诲睘鎬� + foreach (string line in lines) + { + if (line.Contains(":")) + { + string[] parts = line.Split(':'); + string propertyName = parts[0].Trim('[', ']'); + string propertyValue = parts[1].Trim(); + + // 鏍规嵁灞炴�у悕璧嬪�� + switch (propertyName) + { + case "琛ㄥ悕": + entity.琛ㄥ悕 = propertyValue; + break; + case "瀹炰綋绫诲悕": + entity.瀹炰綋绫诲悕 = propertyValue; + break; + case "瀹炰綋绫诲璞″悕": + entity.瀹炰綋绫诲璞″悕 = propertyValue; + break; + case "椤甸潰鑿滃崟鍚�": + entity.椤甸潰鑿滃崟鍚� = propertyValue; + break; + case "椤甸潰鑿滃崟瀵硅薄缂╁啓": + entity.椤甸潰鑿滃崟瀵硅薄缂╁啓 = propertyValue; + break; + case "琛ㄧ殑涓枃娉ㄨВ": + entity.琛ㄧ殑涓枃娉ㄨВ = propertyValue; + break; + case "閲嶅鎬ф牎楠屽瓧娈�": + entity.閲嶅鎬ф牎楠屽瓧娈� = propertyValue; + break; + case "鍒犻櫎鎻愮ず瀛楁": + entity.鍒犻櫎鎻愮ず瀛楁 = propertyValue; + break; + case "妯$硦鏌ヨ瀛楁": + entity.妯$硦鏌ヨ瀛楁 = propertyValue; + break; + case "妯$硦鏌ヨ瀛楁鍚�": + entity.妯$硦鏌ヨ瀛楁鍚� = propertyValue; + break; + case "椤圭洰鍛藉悕绌洪棿": + entity.椤圭洰鍛藉悕绌洪棿 = propertyValue; + break; + case "鏋氫妇绫诲瀷瀛楁闆嗗悎": + entity.鏋氫妇绫诲瀷瀛楁闆嗗悎 = propertyValue; + break; + } + } + } + + //缁欑晫闈㈣祴鍊� + this.tb_TableName.Text = "";//琛ㄥ悕 + this.tb_WCF_NameSpacePath.Text = "";//琛ㄥ悕 + this.tb_ChinaComment.Text = "";//琛ㄥ悕 + this.tb_MenuName.Text = "";//琛ㄥ悕 + this.tb_PageMenuInstanceName.Text = "";//琛ㄥ悕 + this.tb_EntityName.Text = "";//琛ㄥ悕 + + this.tb_LikeQueryAttrs.Text = "";//琛ㄥ悕 + this.tb_LikeQueryAttrsName.Text = "";//琛ㄥ悕 + + this.tb_EntityProName.Text = "";//琛ㄥ悕 + this.tb_EnumList.Text = "";//琛ㄥ悕 + this.tb_ValidateRepeatName.Text = "";//琛ㄥ悕 + this.tb_DeleteAlertAttr.Text = "";//琛ㄥ悕 + + this.tb_TableName.Text = entity.琛ㄥ悕;//琛ㄥ悕 + this.tb_WCF_NameSpacePath.Text = entity.椤圭洰鍛藉悕绌洪棿;//WCF椤圭洰鍛藉悕绌洪棿 + this.tb_ChinaComment.Text = entity.琛ㄧ殑涓枃娉ㄨВ;//涓枃娉ㄩ噴 + this.tb_MenuName.Text = entity.椤甸潰鑿滃崟鍚�; + this.tb_PageMenuInstanceName.Text = entity.椤甸潰鑿滃崟瀵硅薄缂╁啓; + this.tb_EntityName.Text = entity.瀹炰綋绫诲悕;//瀹炰綋绫诲悕 + + this.tb_LikeQueryAttrs.Text = entity.妯$硦鏌ヨ瀛楁; + this.tb_LikeQueryAttrsName.Text = entity.妯$硦鏌ヨ瀛楁鍚�; + + this.tb_EntityProName.Text = entity.瀹炰綋绫诲璞″悕;//瀹炰綋绫诲璞″悕 + this.tb_EnumList.Text = entity.鏋氫妇绫诲瀷瀛楁闆嗗悎; + this.tb_ValidateRepeatName.Text = entity.閲嶅鎬ф牎楠屽瓧娈�; + this.tb_DeleteAlertAttr.Text = entity.鍒犻櫎鎻愮ず瀛楁; + + } + catch (FileNotFoundException) + { + Console.WriteLine("閿欒: 鏂囦欢鏈壘鍒�!"); + } + catch (Exception ex) + { + Console.WriteLine($"閿欒: 鍙戠敓浜嗕竴涓湭鐭ラ敊璇�: {ex.Message}"); + } + } + + private void button1_Click_1(object sender, EventArgs e) + { + this.tb_FilePath.Text = ""; + } } } -- Gitblit v1.9.3