feat(ALL):优化生成逻辑

main
forget_the_bright 6 months ago
parent 73061c1209
commit fcb794e404

@ -52,6 +52,7 @@
this.isGeneratorValidateClass = new System.Windows.Forms.CheckBox(); this.isGeneratorValidateClass = new System.Windows.Forms.CheckBox();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.isGeneratorDynamicTableName = new System.Windows.Forms.CheckBox(); this.isGeneratorDynamicTableName = new System.Windows.Forms.CheckBox();
this.openGeneratorFolder = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// modelGen // modelGen
@ -159,7 +160,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(87, 405); this.label4.Location = new System.Drawing.Point(73, 405);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(827, 12); this.label4.Size = new System.Drawing.Size(827, 12);
this.label4.TabIndex = 77; this.label4.TabIndex = 77;
@ -234,11 +235,11 @@
// databaseLable // databaseLable
// //
this.databaseLable.AutoSize = true; this.databaseLable.AutoSize = true;
this.databaseLable.Location = new System.Drawing.Point(140, 17); this.databaseLable.Location = new System.Drawing.Point(123, 16);
this.databaseLable.Name = "databaseLable"; this.databaseLable.Name = "databaseLable";
this.databaseLable.Size = new System.Drawing.Size(41, 12); this.databaseLable.Size = new System.Drawing.Size(65, 12);
this.databaseLable.TabIndex = 84; this.databaseLable.TabIndex = 84;
this.databaseLable.Text = "名:"; this.databaseLable.Text = "数据库名:";
// //
// label7 // label7
// //
@ -276,11 +277,22 @@
this.isGeneratorDynamicTableName.TabIndex = 88; this.isGeneratorDynamicTableName.TabIndex = 88;
this.isGeneratorDynamicTableName.UseVisualStyleBackColor = true; this.isGeneratorDynamicTableName.UseVisualStyleBackColor = true;
// //
// openGeneratorFolder
//
this.openGeneratorFolder.Location = new System.Drawing.Point(208, 322);
this.openGeneratorFolder.Name = "openGeneratorFolder";
this.openGeneratorFolder.Size = new System.Drawing.Size(102, 23);
this.openGeneratorFolder.TabIndex = 90;
this.openGeneratorFolder.Text = "打开生成目录";
this.openGeneratorFolder.UseVisualStyleBackColor = true;
this.openGeneratorFolder.Click += new System.EventHandler(this.openGeneratorFolder_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1065, 778); this.ClientSize = new System.Drawing.Size(1065, 778);
this.Controls.Add(this.openGeneratorFolder);
this.Controls.Add(this.label8); this.Controls.Add(this.label8);
this.Controls.Add(this.isGeneratorDynamicTableName); this.Controls.Add(this.isGeneratorDynamicTableName);
this.Controls.Add(this.label7); this.Controls.Add(this.label7);
@ -339,6 +351,7 @@
private System.Windows.Forms.CheckBox isGeneratorValidateClass; private System.Windows.Forms.CheckBox isGeneratorValidateClass;
private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label8;
private System.Windows.Forms.CheckBox isGeneratorDynamicTableName; private System.Windows.Forms.CheckBox isGeneratorDynamicTableName;
private System.Windows.Forms.Button openGeneratorFolder;
} }
} }

@ -2,8 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
using GenerateClass.Util; using GenerateClass.Util;
using JinianNet.JNTemplate; using JinianNet.JNTemplate;
using MySqlX.XDevAPI.Common;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace GenerateClass namespace GenerateClass
@ -222,5 +224,10 @@ namespace GenerateClass
this.txt_tablename.Text = ""; this.txt_tablename.Text = "";
this.txt_tablename.Items.AddRange(DbUtil.GetTableName().ToArray()); this.txt_tablename.Items.AddRange(DbUtil.GetTableName().ToArray());
} }
private void openGeneratorFolder_Click(object sender, EventArgs e)
{
DbUtil.openFile();
}
} }
} }

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<SystemConfig> <SystemConfig>
<config name ="DataBaseType" ivalue="MYSQL" remark ="系统数据库类型"> </config> <config name ="DataBaseType" ivalue="MYSQL" remark ="系统数据库类型"> </config>
<config name ="ConnString" ivalue ="server=10.40.18.18;port=3306;user=hbl;password=hbl_password; database=mesdb_nca;" remark ="数据库连接字符串"> </config> <config name ="ConnString" ivalue ="server=10.40.18.18;port=3306;user=hbl;password=hbl_password; database=mesdb_nca_prod_test;" remark ="数据库连接字符串"> </config>
<config name ="SystemParameter_tbname" ivalue="SYS_SystemParameter" remark ="系统初始参数表"> </config> <config name ="SystemParameter_tbname" ivalue="SYS_SystemParameter" remark ="系统初始参数表"> </config>
</SystemConfig> </SystemConfig>

@ -4,7 +4,7 @@ using FluentValidation;
$end $end
using System.ComponentModel; using System.ComponentModel;
using NCA_MES_Models.CommonUtils.DB.DBAttribute; using NCA_MES_Models.CommonUtils.DB.DBAttribute;
//using NCA_MES_Models.CommUtil.DB.DBAttribute; //using NAC_MES_InterfaceLib.CommUtil.DB.DBAttribute;
namespace ${namespace_name} namespace ${namespace_name}
{ {
/// <summary> /// <summary>

@ -24,7 +24,14 @@ namespace GenerateClass.Util
// 打开文件夹 // 打开文件夹
System.Diagnostics.Process.Start(folderPath); System.Diagnostics.Process.Start(folderPath);
} }
public static void openFile()
{
// 创建文件夹
string folderPath = Path.Combine(Environment.CurrentDirectory, folderName);
Directory.CreateDirectory(folderPath);
// 打开文件夹
System.Diagnostics.Process.Start(folderPath);
}
public static string joinList(List<string> list) public static string joinList(List<string> list)
{ {
string str = ""; string str = "";

Loading…
Cancel
Save