From 18dc4a23b6d984face8ad9ff2e7396a43cb0cd4d Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 19 二月 2024 16:36:00 +0800
Subject: [PATCH] 更新~

---
 JavaCode/FrmEtown.cs |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/JavaCode/FrmEtown.cs b/JavaCode/FrmEtown.cs
index 3a84574..f3515bc 100644
--- a/JavaCode/FrmEtown.cs
+++ b/JavaCode/FrmEtown.cs
@@ -158,7 +158,7 @@
             if (!Directory.Exists(path)) Directory.CreateDirectory(path);
 
             string tabName = this.txtTabPrefix.Text.Trim() + name;
-            string shortName = GetEntityName(name, true);
+            string shortName = GetEntityName(name);
 
             string mapperNS = this.txtMapperNS.Text.Trim();
             string mapperName = shortName + "Mapper";
@@ -196,7 +196,7 @@
 
             string tabName = this.txtTabPrefix.Text.Trim() + name;
             //string shortName = NameConvert(name, true);
-            string shortName = GetEntityName(name, true);
+            string shortName = GetEntityName(name);
 
             string entityNS = this.txtEntityNS.Text.Trim();
             string entityName = shortName + "Entity";
@@ -235,7 +235,6 @@
                 sb.Append("\r\n");
                 string colName = NameConvert(ti.col, false);
                 //if ("references" == colName) sb.Append("    @TableField(value = \"\\\"references\\\"\")").Append("\r\n");
-
                 SysDict dict = FindSysDict(dicts, ti.col);
                 if (null != dict && !string.IsNullOrEmpty(dict.alias))
                 {
@@ -350,23 +349,25 @@
             return tabs;
         }
 
-        private static string GetEntityName(string name, bool firstUpper)
+        private static string GetEntityName(string name)
         {
-            return firstUpper ? ToUpperFirst(name.Replace("_", "")) : name.Replace("_", "");
+            string[] strs = name.ToLower().Split(new char[] { '_' });
+            for (int i = 0, c = strs.Length; i < c; i++)
+            {
+                strs[i] = ToUpperFirst(strs[i]);
+            }
+
+            return string.Join("", strs);
         }
 
         private static string NameConvert(string name, bool firstUpper)
         {
-            string[] strs = name.Split(new char[] { '_' });
-
+            string[] strs = name.ToLower().Split(new char[] { '_' });
             for (int i = 0, c = strs.Length; i < c; i++)
             {
-                if (0 == i && !firstUpper)
-                {
-                    continue;
-                }
+                if (0 == i && !firstUpper) continue;
 
-                strs[i] = char.IsDigit(strs[i][0]) ? "_" + strs[i] : ToUpperFirst(strs[i]);
+                strs[i] = ToUpperFirst(strs[i]);
             }
 
             return string.Join("", strs);

--
Gitblit v1.9.3