From 7ecca2a5e7a9c9ae811b68dc98e05c689b18aca6 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周日, 04 5月 2025 15:41:43 +0800
Subject: [PATCH] 222
---
Weben_CMS专用代码生成器/Code/MainForm.cs | 26 ++++
Weben_CMS专用代码生成器/Code/Model/GenerateCodeParam.cs | 16 ++
Weben_CMS专用代码生成器/Code/Generate/Entity/Dto_Generate.cs | 35 +++++
Weben_CMS专用代码生成器/Code/MainForm.Designer.cs | 99 +++++++++++-----
Weben_CMS专用代码生成器/Code/Generate/Entity/CreateOrUpdateDtoBase_Generate.cs | 2
Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj | 4
Weben_CMS专用代码生成器/版本说明.txt | 2
Weben_CMS专用代码生成器/Code/Utility/StructStrHelper.cs | 103 ++++++++++++++++
Weben_CMS专用代码生成器/Code/Templete/Entity/Dto模板.txt | 33 +++++
Weben_CMS专用代码生成器/Code/Generate/Entity/AddModel_Generate.cs | 2
10 files changed, 284 insertions(+), 38 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/Generate/Entity/AddModel_Generate.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/Generate/Entity/AddModel_Generate.cs"
index b262358..87e7f8d 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/Generate/Entity/AddModel_Generate.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/Generate/Entity/AddModel_Generate.cs"
@@ -25,7 +25,7 @@
List<ColumnModel> newColumnNameList = ListHelper.RemoveIdCreatorModifier(columnNameList);
for (int i = 0; i < newColumnNameList.Count; ++i)
{
- attrString += StructStrHelper.GenerateAttributeForAddModel(newColumnNameList[i]);
+ // attrString += StructStrHelper.GenerateAttributeForAddModel(newColumnNameList[i]);
}
str = str.Replace("$AddAttributes$", attrString);
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/Generate/Entity/CreateOrUpdateDtoBase_Generate.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/Generate/Entity/CreateOrUpdateDtoBase_Generate.cs"
index 1b1f12c..e94a846 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/Generate/Entity/CreateOrUpdateDtoBase_Generate.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/Generate/Entity/CreateOrUpdateDtoBase_Generate.cs"
@@ -25,7 +25,7 @@
List<ColumnModel> newColumnNameList = ListHelper.RemoveIdCreatorModifier(param.ColumnNameList);
for (int i = 0; i < newColumnNameList.Count; ++i)
{
- attrString += StructStrHelper.GenerateAttributeForAddModel(newColumnNameList[i]);
+ attrString += StructStrHelper.GenerateAttributeForAddModel(newColumnNameList[i], param);
}
str = str.Replace("$AddAttributes$", attrString);
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/Generate/Entity/Dto_Generate.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/Generate/Entity/Dto_Generate.cs"
new file mode 100644
index 0000000..c9d5986
--- /dev/null
+++ "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/Generate/Entity/Dto_Generate.cs"
@@ -0,0 +1,35 @@
+锘�
+
+using GenerateCode_WeiBen_WMS.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GenerateCode_GEBrilliantFactory
+{
+ /// <summary>
+ /// 鐢熸垚鏌ヨ瀹炰綋绫�
+ /// </summary>
+ public class Dto_Generate : BaseGenerate
+ {
+ public static string CreateText(GenerateCodeParam param)
+ {
+ var str = TextHelper.ReadText(@"Templete\Entity\Dto妯℃澘.txt");
+ CommonReplace(ref str);
+
+ CommonHelper.CommonReplaceStr(param, ref str);
+
+ string attrString = "";
+
+ List<ColumnModel> newColumnNameList = ListHelper.OnlyRemoveId(param.ColumnNameList);
+ for (int i = 0; i < newColumnNameList.Count; ++i)
+ {
+ attrString += StructStrHelper.GenerateAttributeForDto(newColumnNameList[i], param);
+ }
+ str = str.Replace("$AddAttributesForDto$", attrString);
+
+ return str;
+ }
+ }
+}
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/GenerateCode_WeiBen_CMS.csproj" "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/GenerateCode_WeiBen_CMS.csproj"
index 1fc63a7..9a11d30 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/GenerateCode_WeiBen_CMS.csproj"
+++ "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/GenerateCode_WeiBen_CMS.csproj"
@@ -109,6 +109,7 @@
<Compile Include="Generate\BaseGenerate.cs" />
<Compile Include="Generate\Controller\Controller_Generate.cs" />
<Compile Include="Generate\Entity\AddModel_Generate.cs" />
+ <Compile Include="Generate\Entity\Dto_Generate.cs" />
<Compile Include="Generate\Entity\UpdateDto_Generate.cs" />
<Compile Include="Generate\Entity\CreateOrUpdateDtoBase_Generate.cs" />
<Compile Include="Generate\Entity\CreateDto_Generate.cs" />
@@ -194,6 +195,9 @@
<Content Include="Templete\Entity\AddModel妯℃澘.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="Templete\Entity\Dto妯℃澘.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="Templete\Entity\UpdateDto妯℃澘.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
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.Designer.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.Designer.cs"
index fe3e9df..6059ec2 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.Designer.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.Designer.cs"
@@ -74,6 +74,9 @@
this.label12 = new System.Windows.Forms.Label();
this.tb_templeteFileDownName = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
+ this.tb_EnumList = new System.Windows.Forms.TextBox();
+ this.label18 = new System.Windows.Forms.Label();
+ this.label19 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -82,7 +85,7 @@
// btnPath
//
this.btnPath.Location = new System.Drawing.Point(567, 712);
- this.btnPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.btnPath.Margin = new System.Windows.Forms.Padding(4);
this.btnPath.Name = "btnPath";
this.btnPath.Size = new System.Drawing.Size(129, 29);
this.btnPath.TabIndex = 1;
@@ -103,7 +106,7 @@
// tbPath
//
this.tbPath.Location = new System.Drawing.Point(141, 708);
- this.tbPath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tbPath.Margin = new System.Windows.Forms.Padding(4);
this.tbPath.Name = "tbPath";
this.tbPath.ReadOnly = true;
this.tbPath.Size = new System.Drawing.Size(336, 25);
@@ -112,7 +115,7 @@
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(865, 750);
- this.btnExit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.btnExit.Margin = new System.Windows.Forms.Padding(4);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(228, 84);
this.btnExit.TabIndex = 8;
@@ -123,7 +126,7 @@
// btn_CreateFile
//
this.btn_CreateFile.Location = new System.Drawing.Point(141, 750);
- this.btn_CreateFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.btn_CreateFile.Margin = new System.Windows.Forms.Padding(4);
this.btn_CreateFile.Name = "btn_CreateFile";
this.btn_CreateFile.Size = new System.Drawing.Size(209, 84);
this.btn_CreateFile.TabIndex = 14;
@@ -134,7 +137,7 @@
// tb_TableName
//
this.tb_TableName.Location = new System.Drawing.Point(123, 86);
- this.tb_TableName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_TableName.Margin = new System.Windows.Forms.Padding(4);
this.tb_TableName.Name = "tb_TableName";
this.tb_TableName.Size = new System.Drawing.Size(243, 25);
this.tb_TableName.TabIndex = 15;
@@ -143,7 +146,7 @@
// tb_FileName
//
this.tb_FileName.Location = new System.Drawing.Point(295, 190);
- this.tb_FileName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_FileName.Margin = new System.Windows.Forms.Padding(4);
this.tb_FileName.Name = "tb_FileName";
this.tb_FileName.Size = new System.Drawing.Size(264, 25);
this.tb_FileName.TabIndex = 17;
@@ -161,7 +164,7 @@
// tb_WCF_NameSpacePath
//
this.tb_WCF_NameSpacePath.Location = new System.Drawing.Point(751, 309);
- this.tb_WCF_NameSpacePath.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_WCF_NameSpacePath.Margin = new System.Windows.Forms.Padding(4);
this.tb_WCF_NameSpacePath.Name = "tb_WCF_NameSpacePath";
this.tb_WCF_NameSpacePath.Size = new System.Drawing.Size(261, 25);
this.tb_WCF_NameSpacePath.TabIndex = 19;
@@ -179,7 +182,7 @@
// tb_ChinaComment
//
this.tb_ChinaComment.Location = new System.Drawing.Point(295, 292);
- this.tb_ChinaComment.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_ChinaComment.Margin = new System.Windows.Forms.Padding(4);
this.tb_ChinaComment.Name = "tb_ChinaComment";
this.tb_ChinaComment.Size = new System.Drawing.Size(261, 25);
this.tb_ChinaComment.TabIndex = 23;
@@ -197,7 +200,7 @@
// tb_CreatePerson
//
this.tb_CreatePerson.Location = new System.Drawing.Point(295, 349);
- this.tb_CreatePerson.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_CreatePerson.Margin = new System.Windows.Forms.Padding(4);
this.tb_CreatePerson.Name = "tb_CreatePerson";
this.tb_CreatePerson.Size = new System.Drawing.Size(264, 25);
this.tb_CreatePerson.TabIndex = 25;
@@ -215,7 +218,7 @@
// tb_Primary
//
this.tb_Primary.Location = new System.Drawing.Point(451, 86);
- this.tb_Primary.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_Primary.Margin = new System.Windows.Forms.Padding(4);
this.tb_Primary.Name = "tb_Primary";
this.tb_Primary.Size = new System.Drawing.Size(192, 25);
this.tb_Primary.TabIndex = 27;
@@ -233,7 +236,7 @@
// tb_EntityProName
//
this.tb_EntityProName.Location = new System.Drawing.Point(747, 176);
- this.tb_EntityProName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_EntityProName.Margin = new System.Windows.Forms.Padding(4);
this.tb_EntityProName.Name = "tb_EntityProName";
this.tb_EntityProName.Size = new System.Drawing.Size(243, 25);
this.tb_EntityProName.TabIndex = 31;
@@ -252,7 +255,7 @@
// tb_EntityName
//
this.tb_EntityName.Location = new System.Drawing.Point(123, 135);
- this.tb_EntityName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_EntityName.Margin = new System.Windows.Forms.Padding(4);
this.tb_EntityName.Name = "tb_EntityName";
this.tb_EntityName.Size = new System.Drawing.Size(243, 25);
this.tb_EntityName.TabIndex = 29;
@@ -280,7 +283,7 @@
// tb_OrderBy
//
this.tb_OrderBy.Location = new System.Drawing.Point(671, 259);
- this.tb_OrderBy.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_OrderBy.Margin = new System.Windows.Forms.Padding(4);
this.tb_OrderBy.Name = "tb_OrderBy";
this.tb_OrderBy.Size = new System.Drawing.Size(192, 25);
this.tb_OrderBy.TabIndex = 35;
@@ -298,7 +301,7 @@
// tb_PrimaryDesc
//
this.tb_PrimaryDesc.Location = new System.Drawing.Point(759, 86);
- this.tb_PrimaryDesc.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_PrimaryDesc.Margin = new System.Windows.Forms.Padding(4);
this.tb_PrimaryDesc.Name = "tb_PrimaryDesc";
this.tb_PrimaryDesc.Size = new System.Drawing.Size(192, 25);
this.tb_PrimaryDesc.TabIndex = 38;
@@ -316,7 +319,7 @@
// tb_Modulelogo
//
this.tb_Modulelogo.Location = new System.Drawing.Point(295, 252);
- this.tb_Modulelogo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_Modulelogo.Margin = new System.Windows.Forms.Padding(4);
this.tb_Modulelogo.Name = "tb_Modulelogo";
this.tb_Modulelogo.Size = new System.Drawing.Size(264, 25);
this.tb_Modulelogo.TabIndex = 41;
@@ -334,7 +337,7 @@
// btn_InsertSql
//
this.btn_InsertSql.Location = new System.Drawing.Point(513, 750);
- this.btn_InsertSql.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.btn_InsertSql.Margin = new System.Windows.Forms.Padding(4);
this.btn_InsertSql.Name = "btn_InsertSql";
this.btn_InsertSql.Size = new System.Drawing.Size(209, 84);
this.btn_InsertSql.TabIndex = 42;
@@ -346,7 +349,7 @@
// tb_RoutePrefix
//
this.tb_RoutePrefix.Location = new System.Drawing.Point(717, 345);
- this.tb_RoutePrefix.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_RoutePrefix.Margin = new System.Windows.Forms.Padding(4);
this.tb_RoutePrefix.Name = "tb_RoutePrefix";
this.tb_RoutePrefix.Size = new System.Drawing.Size(192, 25);
this.tb_RoutePrefix.TabIndex = 44;
@@ -370,9 +373,9 @@
this.groupBox1.Controls.Add(this.lbl_DataSource);
this.groupBox1.Controls.Add(this.cmb_DataSource);
this.groupBox1.Location = new System.Drawing.Point(68, 15);
- this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(1092, 90);
this.groupBox1.TabIndex = 45;
this.groupBox1.TabStop = false;
@@ -392,7 +395,7 @@
//
this.cmb_DataBase.FormattingEnabled = true;
this.cmb_DataBase.Location = new System.Drawing.Point(775, 25);
- this.cmb_DataBase.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.cmb_DataBase.Margin = new System.Windows.Forms.Padding(4);
this.cmb_DataBase.Name = "cmb_DataBase";
this.cmb_DataBase.Size = new System.Drawing.Size(273, 23);
this.cmb_DataBase.TabIndex = 2;
@@ -412,7 +415,7 @@
//
this.cmb_DataSource.FormattingEnabled = true;
this.cmb_DataSource.Location = new System.Drawing.Point(8, 25);
- this.cmb_DataSource.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.cmb_DataSource.Margin = new System.Windows.Forms.Padding(4);
this.cmb_DataSource.Name = "cmb_DataSource";
this.cmb_DataSource.Size = new System.Drawing.Size(273, 23);
this.cmb_DataSource.TabIndex = 0;
@@ -420,6 +423,9 @@
//
// groupBox2
//
+ this.groupBox2.Controls.Add(this.label19);
+ this.groupBox2.Controls.Add(this.label18);
+ this.groupBox2.Controls.Add(this.tb_EnumList);
this.groupBox2.Controls.Add(this.tb_GroupName);
this.groupBox2.Controls.Add(this.label16);
this.groupBox2.Controls.Add(this.label15);
@@ -451,10 +457,10 @@
this.groupBox2.Controls.Add(this.tb_EntityName);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Location = new System.Drawing.Point(68, 112);
- this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox2.Size = new System.Drawing.Size(1092, 588);
+ this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
+ this.groupBox2.Size = new System.Drawing.Size(1293, 588);
this.groupBox2.TabIndex = 46;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "鑷畾涔夐厤缃�";
@@ -462,7 +468,7 @@
// tb_GroupName
//
this.tb_GroupName.Location = new System.Drawing.Point(467, 135);
- this.tb_GroupName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_GroupName.Margin = new System.Windows.Forms.Padding(4);
this.tb_GroupName.Name = "tb_GroupName";
this.tb_GroupName.Size = new System.Drawing.Size(243, 25);
this.tb_GroupName.TabIndex = 50;
@@ -490,7 +496,7 @@
// tb_ProjectNamePrefix
//
this.tb_ProjectNamePrefix.Location = new System.Drawing.Point(139, 26);
- this.tb_ProjectNamePrefix.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_ProjectNamePrefix.Margin = new System.Windows.Forms.Padding(4);
this.tb_ProjectNamePrefix.Name = "tb_ProjectNamePrefix";
this.tb_ProjectNamePrefix.Size = new System.Drawing.Size(243, 25);
this.tb_ProjectNamePrefix.TabIndex = 48;
@@ -514,7 +520,7 @@
// tb_importExcelCategroy
//
this.tb_importExcelCategroy.Location = new System.Drawing.Point(191, 108);
- this.tb_importExcelCategroy.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_importExcelCategroy.Margin = new System.Windows.Forms.Padding(4);
this.tb_importExcelCategroy.Name = "tb_importExcelCategroy";
this.tb_importExcelCategroy.Size = new System.Drawing.Size(149, 25);
this.tb_importExcelCategroy.TabIndex = 50;
@@ -545,7 +551,7 @@
// tb_templeteFileDownName
//
this.tb_templeteFileDownName.Location = new System.Drawing.Point(191, 72);
- this.tb_templeteFileDownName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.tb_templeteFileDownName.Margin = new System.Windows.Forms.Padding(4);
this.tb_templeteFileDownName.Name = "tb_templeteFileDownName";
this.tb_templeteFileDownName.Size = new System.Drawing.Size(149, 25);
this.tb_templeteFileDownName.TabIndex = 48;
@@ -560,11 +566,41 @@
this.label14.TabIndex = 47;
this.label14.Text = "鏂囦欢涓嬭浇鍚嶅瓧:";
//
+ // tb_EnumList
+ //
+ this.tb_EnumList.Location = new System.Drawing.Point(557, 451);
+ this.tb_EnumList.Margin = new System.Windows.Forms.Padding(4);
+ this.tb_EnumList.Multiline = true;
+ this.tb_EnumList.Name = "tb_EnumList";
+ this.tb_EnumList.Size = new System.Drawing.Size(491, 129);
+ this.tb_EnumList.TabIndex = 51;
+ //
+ // label18
+ //
+ this.label18.AutoSize = true;
+ this.label18.Location = new System.Drawing.Point(424, 488);
+ this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(135, 15);
+ this.label18.TabIndex = 52;
+ this.label18.Text = "鏋氫妇绫诲瀷瀛楁闆嗗悎:";
+ //
+ // label19
+ //
+ this.label19.AutoSize = true;
+ this.label19.Location = new System.Drawing.Point(424, 432);
+ this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label19.Name = "label19";
+ this.label19.Size = new System.Drawing.Size(751, 15);
+ this.label19.TabIndex = 53;
+ this.label19.Text = "PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|Mate" +
+ "rialTypeDesc";
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1236, 840);
+ this.ClientSize = new System.Drawing.Size(1374, 840);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btn_InsertSql);
@@ -572,7 +608,7 @@
this.Controls.Add(this.btnExit);
this.Controls.Add(this.tbPath);
this.Controls.Add(this.btnPath);
- this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "浼熸湰-CMS-浠g爜鐢熸垚鍣�(浼熸湰涓撶敤)V1.0";
@@ -636,6 +672,9 @@
private System.Windows.Forms.TextBox tb_GroupName;
private System.Windows.Forms.ComboBox cmb_DataBase;
private System.Windows.Forms.Label label17;
+ private System.Windows.Forms.Label label18;
+ private System.Windows.Forms.TextBox tb_EnumList;
+ private System.Windows.Forms.Label label19;
}
}
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 f8d6fdd..f5ade14 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"
@@ -32,8 +32,8 @@
this.tb_FileName.Text = "Xiangzi";//鏂囦欢鍓嶇紑鍚�
this.tb_ChinaComment.Text = "鐗╂枡鍩虹淇℃伅琛�";//涓枃娉ㄩ噴
this.tb_CreatePerson.Text = "shaocx";//鍒涘缓浜�
- this.tb_EntityName.Text = "WmsMaterials";//瀹炰綋绫诲悕
- this.tb_EntityProName.Text = "_wmsMaterials";//瀹炰綋绫诲璞″悕
+ this.tb_EntityName.Text = "WmsMaterial";//瀹炰綋绫诲悕
+ this.tb_EntityProName.Text = "_wmsMaterial";//瀹炰綋绫诲璞″悕
this.cmb_DataSource.DropDownStyle = ComboBoxStyle.DropDownList;
List<ListItem> itemList = CommonHelper.GetDataSources();
@@ -163,6 +163,24 @@
ColumnNameList = columnList,
EntityName = entityName
};
+ //澶勭悊鏋氫妇绫诲瀷
+ List<EnumModel> enumList = new List<EnumModel>();
+ var str_enumList = this.tb_EnumList.Text.Trim();
+ if (str_enumList.IndexOf(',') > -1)
+ {
+ var arr_enumList = str_enumList.Split(',');
+ foreach (var item in arr_enumList)
+ {
+ var arr_single = item.Split('|');
+ enumList.Add(new EnumModel()
+ {
+ EnumAttrName = arr_single[0],
+ EnumType = arr_single[1],
+ EnumTypeDesc = arr_single[2]
+ });
+ }
+ }
+ param.EnumList = enumList;
//鐢熸垚Model
//CreateModelFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
@@ -186,6 +204,10 @@
str_generate = CreateOrUpdateDtoBase_Generate.CreateText(param);
tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}CreateOrUpdateDtoBase.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
+ //5銆佺敓鎴� Dto 鏂囦欢
+ str_generate = Dto_Generate.CreateText(param);
+ tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}Dto.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
+
#endregion
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/Model/GenerateCodeParam.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/Model/GenerateCodeParam.cs"
index 79e5f6d..c06ed6d 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/Model/GenerateCodeParam.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/Model/GenerateCodeParam.cs"
@@ -36,5 +36,21 @@
/// 鍛藉悕绌洪棿
/// </summary>
public string NameSpacePath { get; set; }
+
+ /// <summary>
+ /// 浣跨敤鐨勬灇涓惧垪琛�
+ /// </summary>
+ public List<EnumModel> EnumList { get; set; } = new List<EnumModel>();
+ }
+
+ public class EnumModel
+ {
+ /// <summary>
+ /// 鏋氫妇灞炴�у悕
+ /// </summary>
+ public string EnumAttrName { get; set; }
+ public string EnumType { get; set; }
+ public string EnumTypeDesc { get; set; }
+
}
}
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/Templete/Entity/Dto\346\250\241\346\235\277.txt" "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/Templete/Entity/Dto\346\250\241\346\235\277.txt"
new file mode 100644
index 0000000..d32df4c
--- /dev/null
+++ "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/Templete/Entity/Dto\346\250\241\346\235\277.txt"
@@ -0,0 +1,33 @@
+using CMS.Plugin.$NameSpacePath$.Domain.Shared.Enums;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Domain.Entities;
+
+namespace CMS.Plugin.$NameSpacePath$.Application.Contracts.Dtos.$EntityName$;
+
+/// <summary>
+/// $ChinaComment$数据参数对象
+/// </summary>
+public class $EntityName$Dto: ExtensibleEntityDto<Guid>, IHasConcurrencyStamp
+{
+ $AddAttributesForDto$
+
+ /// <summary>
+ /// 并发戳
+ /// </summary>
+ public string ConcurrencyStamp { get; set; }
+
+ /// <summary>
+ /// Gets the export data.
+ /// </summary>
+ /// <returns></returns>
+ public Dictionary<string, object> GetExportData()
+ {
+ var exportData = new Dictionary<string, object>();
+ foreach (var property in this.GetType().GetProperties())
+ {
+ exportData.Add(property.Name, property.GetValue(this));
+ }
+
+ return exportData;
+ }
+}
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/Utility/StructStrHelper.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/Utility/StructStrHelper.cs"
index 2fafbe8..73c8103 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/Utility/StructStrHelper.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/Utility/StructStrHelper.cs"
@@ -1,8 +1,10 @@
-锘縰sing System;
+锘縰sing GenerateCode_WeiBen_WMS.Model;
+using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
+using System.Linq;
using System.Text;
namespace GenerateCode_GEBrilliantFactory
@@ -216,7 +218,7 @@
/// </summary>
/// <param name="columnModel"></param>
/// <returns></returns>
- public static string GenerateAttributeForAddModel(ColumnModel columnModel)
+ public static string GenerateAttributeForAddModel(ColumnModel columnModel,GenerateCodeParam param)
{
try
{
@@ -248,8 +250,17 @@
break;
case DataTypeEnum.dt_int:
if (columnModel.IsNullable) { str_NullFlag = "? "; }
- attrStr += " public int" + str_NullFlag + attr + " { get; set; }\n";
- attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ var findEnumObj = param.EnumList.Where(x => x.EnumAttrName == attr).FirstOrDefault();
+ if (findEnumObj != null)
+ {
+ attrStr += $" public {findEnumObj.EnumType}" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ }
+ else
+ {
+ attrStr += " public int" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ }
break;
default:
attrStr += " public string" + str_NullFlag + attr + " { get; set; }\n";
@@ -267,6 +278,90 @@
}
/// <summary>
+ /// 鐢熸垚灞炴�у瓧绗︿覆ForAddModel-Dto瀹炰綋涓撶敤
+ /// </summary>
+ /// <param name="columnModel"></param>
+ /// <returns></returns>
+ public static string GenerateAttributeForDto(ColumnModel columnModel, GenerateCodeParam param)
+ {
+ try
+ {
+ string attr = columnModel.ColumnName;
+ //if (attr.ToUpper() == "DBId".ToUpper())
+ //{
+ // var bb = "";
+ //}
+ string str_NullFlag = " ";
+
+ string attrStr = "";
+ attrStr += " /// <summary>\n";
+ attrStr += " /// " + columnModel.Description + "\n";
+ attrStr += " /// </summary>\n";
+
+ DataTypeEnum myDataType = (DataTypeEnum)Enum.Parse(typeof(DataTypeEnum), "dt_" + columnModel.DataType);
+ switch (myDataType)
+ {
+ case DataTypeEnum.dt_datetime:
+ case DataTypeEnum.dt_datetime2:
+ case DataTypeEnum.dt_datetimeoffset:
+ attrStr += " public datetime" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ break;
+ case DataTypeEnum.dt_bigint:
+ if (columnModel.IsNullable) { str_NullFlag = "? "; }
+ attrStr += " public long" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ break;
+ case DataTypeEnum.dt_int:
+ if (columnModel.IsNullable) { str_NullFlag = "? "; }
+ var findEnumObj = param.EnumList.Where(x => x.EnumAttrName == attr).FirstOrDefault();
+ if (findEnumObj != null)
+ {
+ attrStr += $" public {findEnumObj.EnumType}" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ }
+ else
+ {
+ attrStr += " public int" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ }
+
+ break;
+ default:
+ attrStr += " public string" + str_NullFlag + attr + " { get; set; }\n";
+ attrStr += "\n";//鏈�鍚庢槸鍔犱竴涓┖鏍�
+ break;
+ }
+
+ //澧炲姞瀵规灇涓剧被鍨嬬殑鏀寔
+ if (param.EnumList?.Count > 0)
+ {
+ var findEnumObj = param.EnumList.Where(x => x.EnumAttrName == attr).FirstOrDefault();
+ if (findEnumObj != null)
+ {
+ attrStr += " /// <summary>\n";
+ attrStr += " /// " + columnModel.Description + "\n";
+ attrStr += " /// </summary>\n";
+ attrStr += " public string" + str_NullFlag + findEnumObj.EnumTypeDesc + " { get; set; }\n";
+ attrStr += " { \n";
+ attrStr += " get \n";
+ attrStr += " { \n";
+ attrStr += $" return GetEnumDescriptionUtil.GetEnumDescription({findEnumObj.EnumAttrName}); \n";
+ attrStr += " } \n";
+ attrStr += " } \n";
+ }
+ }
+
+ return attrStr;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ }
+
+ /// <summary>
/// 鐢熸垚灞炴�у瓧绗︿覆ForQueryModel- 鏌ヨ瀹炰綋涓撶敤
/// </summary>
/// <param name="columnModel"></param>
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/\347\211\210\346\234\254\350\257\264\346\230\216.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/\347\211\210\346\234\254\350\257\264\346\230\216.txt"
index f611249..2b34f76 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/\347\211\210\346\234\254\350\257\264\346\230\216.txt"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/\347\211\210\346\234\254\350\257\264\346\230\216.txt"
@@ -2,4 +2,6 @@
V1.0
1、创建 2025-04-29
+枚举例子
+PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|MaterialTypeDesc
--
Gitblit v1.9.3