From f7f19e77f6872b3270cfdcead61d735c1e5c6ed8 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 26 一月 2024 11:00:10 +0800
Subject: [PATCH] 添加新功能-亦庄

---
 JavaCode/EtownTemplate/Entity.java |   27 +
 JavaCode/EtownTemplate/Mapper.java |   16 +
 JavaCode/FrmEtown.Designer.cs      |  284 +++++++++++++++++
 JavaCode/FrmEtown.resx             |  120 +++++++
 JavaCode/App.config                |    1 
 JavaCode/cs/PostgreHelper.cs       |   15 
 JavaCode/FrmEtown.cs               |  408 +++++++++++++++++++++++++
 JavaCode/FrmMain.Designer.cs       |   16 
 JavaCode/FrmMain.cs                |    5 
 JavaCode/JavaCode.csproj           |   15 
 10 files changed, 902 insertions(+), 5 deletions(-)

diff --git a/JavaCode/App.config b/JavaCode/App.config
index 7724bf6..cd0d77f 100644
--- a/JavaCode/App.config
+++ b/JavaCode/App.config
@@ -4,6 +4,7 @@
     <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>-->
     <!--<add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>-->
     <add key="pgConn" value="Server=192.168.20.83;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/>
+    <add key="etownConn" value="Server=192.168.20.83;Port=5433;Database=etown;User Id=postgres;Password=postgres;"/>
     <!--<add key="pgConn" value="Server=103.85.165.99;Port=25432;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/>-->
   </appSettings>
   <startup> 
diff --git a/JavaCode/EtownTemplate/Entity.java b/JavaCode/EtownTemplate/Entity.java
new file mode 100644
index 0000000..842f368
--- /dev/null
+++ b/JavaCode/EtownTemplate/Entity.java
@@ -0,0 +1,27 @@
+package {entityNS};
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.smartearth.system.domain.se.BaseGeoEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+
+/**
+ * {bak}实体类
+ * @author WWW
+ * @date {date}
+ */
+@Data
+@ToString
+@SuppressWarnings("ALL")
+@TableName("{tabName}")
+@ApiModel(value = "{bak}实体类")
+@EqualsAndHashCode(callSuper = false)
+public class {entityName} extends BaseGeoEntity implements Serializable {
+    private static final long serialVersionUID = {uid}L;
+	
\ No newline at end of file
diff --git a/JavaCode/EtownTemplate/Mapper.java b/JavaCode/EtownTemplate/Mapper.java
new file mode 100644
index 0000000..8bbcf8f
--- /dev/null
+++ b/JavaCode/EtownTemplate/Mapper.java
@@ -0,0 +1,16 @@
+package {mapperNS};
+
+import {entityNS}.{entityName};
+import com.smartearth.system.mapper.se.BaseGeoMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * {bak}映射类
+ * @author WWW
+ * @date {date}
+ */
+@Mapper
+@Repository
+public interface {mapperName} extends BaseGeoMapper<{entityName}> {
+}
diff --git a/JavaCode/FrmEtown.Designer.cs b/JavaCode/FrmEtown.Designer.cs
new file mode 100644
index 0000000..3459ab9
--- /dev/null
+++ b/JavaCode/FrmEtown.Designer.cs
@@ -0,0 +1,284 @@
+锘縩amespace JavaCode
+{
+    partial class FrmEtown
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.txtTabNS = new System.Windows.Forms.TextBox();
+            this.txtTabPre = new System.Windows.Forms.TextBox();
+            this.btnReadTab = new System.Windows.Forms.Button();
+            this.tabList = new System.Windows.Forms.ListBox();
+            this.dgvTab = new System.Windows.Forms.DataGridView();
+            this.txtEntityNS = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.txtMapperNS = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.btnGeneAll = new System.Windows.Forms.Button();
+            this.btnAll = new System.Windows.Forms.Button();
+            this.btnAnti = new System.Windows.Forms.Button();
+            this.btnNone = new System.Windows.Forms.Button();
+            this.btnGeneEntity = new System.Windows.Forms.Button();
+            this.btnGeneMapper = new System.Windows.Forms.Button();
+            this.txtTabPrefix = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // txtTabNS
+            // 
+            this.txtTabNS.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtTabNS.Location = new System.Drawing.Point(12, 13);
+            this.txtTabNS.Name = "txtTabNS";
+            this.txtTabNS.Size = new System.Drawing.Size(104, 26);
+            this.txtTabNS.TabIndex = 25;
+            this.txtTabNS.Text = "11859871";
+            // 
+            // txtTabPre
+            // 
+            this.txtTabPre.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtTabPre.Location = new System.Drawing.Point(136, 13);
+            this.txtTabPre.Name = "txtTabPre";
+            this.txtTabPre.Size = new System.Drawing.Size(98, 26);
+            this.txtTabPre.TabIndex = 24;
+            // 
+            // btnReadTab
+            // 
+            this.btnReadTab.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnReadTab.Location = new System.Drawing.Point(247, 15);
+            this.btnReadTab.Name = "btnReadTab";
+            this.btnReadTab.Size = new System.Drawing.Size(118, 23);
+            this.btnReadTab.TabIndex = 23;
+            this.btnReadTab.Text = "璇诲彇鏁版嵁搴撹〃";
+            this.btnReadTab.UseVisualStyleBackColor = true;
+            this.btnReadTab.Click += new System.EventHandler(this.btnReadTab_Click);
+            // 
+            // tabList
+            // 
+            this.tabList.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tabList.FormattingEnabled = true;
+            this.tabList.ItemHeight = 16;
+            this.tabList.Location = new System.Drawing.Point(12, 86);
+            this.tabList.Name = "tabList";
+            this.tabList.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
+            this.tabList.Size = new System.Drawing.Size(353, 212);
+            this.tabList.TabIndex = 22;
+            this.tabList.SelectedIndexChanged += new System.EventHandler(this.tabList_SelectedIndexChanged);
+            // 
+            // dgvTab
+            // 
+            this.dgvTab.AllowUserToAddRows = false;
+            this.dgvTab.AllowUserToDeleteRows = false;
+            this.dgvTab.BackgroundColor = System.Drawing.SystemColors.ButtonFace;
+            this.dgvTab.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dgvTab.Location = new System.Drawing.Point(12, 312);
+            this.dgvTab.Margin = new System.Windows.Forms.Padding(0);
+            this.dgvTab.MultiSelect = false;
+            this.dgvTab.Name = "dgvTab";
+            this.dgvTab.ReadOnly = true;
+            this.dgvTab.RowHeadersWidth = 40;
+            this.dgvTab.RowTemplate.Height = 23;
+            this.dgvTab.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+            this.dgvTab.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+            this.dgvTab.Size = new System.Drawing.Size(825, 300);
+            this.dgvTab.TabIndex = 26;
+            // 
+            // txtEntityNS
+            // 
+            this.txtEntityNS.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtEntityNS.Location = new System.Drawing.Point(524, 89);
+            this.txtEntityNS.Name = "txtEntityNS";
+            this.txtEntityNS.Size = new System.Drawing.Size(312, 26);
+            this.txtEntityNS.TabIndex = 30;
+            this.txtEntityNS.Text = "com.smartearth.system.domain.sd";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(385, 94);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(136, 16);
+            this.label3.TabIndex = 29;
+            this.label3.Text = "Entity鍚嶇О绌洪棿锛�";
+            // 
+            // txtMapperNS
+            // 
+            this.txtMapperNS.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtMapperNS.Location = new System.Drawing.Point(524, 53);
+            this.txtMapperNS.Name = "txtMapperNS";
+            this.txtMapperNS.Size = new System.Drawing.Size(312, 26);
+            this.txtMapperNS.TabIndex = 32;
+            this.txtMapperNS.Text = "com.smartearth.system.mapper.sd";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(385, 58);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(136, 16);
+            this.label2.TabIndex = 31;
+            this.label2.Text = "Mapper鍚嶇О绌洪棿锛�";
+            // 
+            // btnGeneAll
+            // 
+            this.btnGeneAll.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnGeneAll.Location = new System.Drawing.Point(524, 208);
+            this.btnGeneAll.Name = "btnGeneAll";
+            this.btnGeneAll.Size = new System.Drawing.Size(312, 25);
+            this.btnGeneAll.TabIndex = 33;
+            this.btnGeneAll.Text = "鐢� 鎴� 鎵� 鏈� 鏂� 浠�";
+            this.btnGeneAll.UseVisualStyleBackColor = true;
+            this.btnGeneAll.Click += new System.EventHandler(this.btnGeneAll_Click);
+            // 
+            // btnAll
+            // 
+            this.btnAll.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnAll.Location = new System.Drawing.Point(12, 53);
+            this.btnAll.Name = "btnAll";
+            this.btnAll.Size = new System.Drawing.Size(104, 23);
+            this.btnAll.TabIndex = 34;
+            this.btnAll.Text = "鍏� 閫�";
+            this.btnAll.UseVisualStyleBackColor = true;
+            this.btnAll.Click += new System.EventHandler(this.btnAll_Click);
+            // 
+            // btnAnti
+            // 
+            this.btnAnti.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnAnti.Location = new System.Drawing.Point(136, 52);
+            this.btnAnti.Name = "btnAnti";
+            this.btnAnti.Size = new System.Drawing.Size(98, 23);
+            this.btnAnti.TabIndex = 35;
+            this.btnAnti.Text = "鍙� 閫�";
+            this.btnAnti.UseVisualStyleBackColor = true;
+            this.btnAnti.Click += new System.EventHandler(this.btnAnti_Click);
+            // 
+            // btnNone
+            // 
+            this.btnNone.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnNone.Location = new System.Drawing.Point(247, 52);
+            this.btnNone.Name = "btnNone";
+            this.btnNone.Size = new System.Drawing.Size(118, 23);
+            this.btnNone.TabIndex = 36;
+            this.btnNone.Text = "鍏� 涓� 閫�";
+            this.btnNone.UseVisualStyleBackColor = true;
+            this.btnNone.Click += new System.EventHandler(this.btnNone_Click);
+            // 
+            // btnGeneEntity
+            // 
+            this.btnGeneEntity.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnGeneEntity.Location = new System.Drawing.Point(524, 169);
+            this.btnGeneEntity.Name = "btnGeneEntity";
+            this.btnGeneEntity.Size = new System.Drawing.Size(312, 25);
+            this.btnGeneEntity.TabIndex = 38;
+            this.btnGeneEntity.Text = "鐢� 鎴� Entity.java";
+            this.btnGeneEntity.UseVisualStyleBackColor = true;
+            this.btnGeneEntity.Click += new System.EventHandler(this.btnGeneEntity_Click);
+            // 
+            // btnGeneMapper
+            // 
+            this.btnGeneMapper.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnGeneMapper.Location = new System.Drawing.Point(524, 128);
+            this.btnGeneMapper.Name = "btnGeneMapper";
+            this.btnGeneMapper.Size = new System.Drawing.Size(312, 25);
+            this.btnGeneMapper.TabIndex = 37;
+            this.btnGeneMapper.Text = "鐢� 鎴� Mapper.java";
+            this.btnGeneMapper.UseVisualStyleBackColor = true;
+            this.btnGeneMapper.Click += new System.EventHandler(this.btnGeneMapper_Click);
+            // 
+            // txtTabPrefix
+            // 
+            this.txtTabPrefix.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtTabPrefix.Location = new System.Drawing.Point(524, 15);
+            this.txtTabPrefix.Name = "txtTabPrefix";
+            this.txtTabPrefix.Size = new System.Drawing.Size(313, 26);
+            this.txtTabPrefix.TabIndex = 40;
+            this.txtTabPrefix.Text = "sd.";
+            this.txtTabPrefix.TextChanged += new System.EventHandler(this.txtTabPrefix_TextChanged);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(433, 20);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(88, 16);
+            this.label1.TabIndex = 39;
+            this.label1.Text = "琛ㄥ悕鍓嶇紑锛�";
+            // 
+            // FrmEtown
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(852, 628);
+            this.Controls.Add(this.txtTabPrefix);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.btnGeneEntity);
+            this.Controls.Add(this.btnGeneMapper);
+            this.Controls.Add(this.btnNone);
+            this.Controls.Add(this.btnAnti);
+            this.Controls.Add(this.btnAll);
+            this.Controls.Add(this.btnGeneAll);
+            this.Controls.Add(this.txtMapperNS);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.txtEntityNS);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.dgvTab);
+            this.Controls.Add(this.txtTabNS);
+            this.Controls.Add(this.txtTabPre);
+            this.Controls.Add(this.btnReadTab);
+            this.Controls.Add(this.tabList);
+            this.Name = "FrmEtown";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "FrmEtown";
+            ((System.ComponentModel.ISupportInitialize)(this.dgvTab)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox txtTabNS;
+        private System.Windows.Forms.TextBox txtTabPre;
+        private System.Windows.Forms.Button btnReadTab;
+        private System.Windows.Forms.ListBox tabList;
+        private System.Windows.Forms.DataGridView dgvTab;
+        private System.Windows.Forms.TextBox txtEntityNS;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox txtMapperNS;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Button btnGeneAll;
+        private System.Windows.Forms.Button btnAll;
+        private System.Windows.Forms.Button btnAnti;
+        private System.Windows.Forms.Button btnNone;
+        private System.Windows.Forms.Button btnGeneEntity;
+        private System.Windows.Forms.Button btnGeneMapper;
+        private System.Windows.Forms.TextBox txtTabPrefix;
+        private System.Windows.Forms.Label label1;
+    }
+}
\ No newline at end of file
diff --git a/JavaCode/FrmEtown.cs b/JavaCode/FrmEtown.cs
new file mode 100644
index 0000000..aa966e7
--- /dev/null
+++ b/JavaCode/FrmEtown.cs
@@ -0,0 +1,408 @@
+锘縰sing JavaCode.cs;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Windows.Forms;
+
+namespace JavaCode
+{
+    public partial class FrmEtown : Form
+    {
+        #region 鎴愬憳鍙橀噺+鏋勯�犲嚱鏁�
+        private static List<string> excludes = new List<string>() { "gid", "eventid", "parentid", "dir", "dep", "createuser", "createtime", "updateuser", "updatetime", "geom", "remarks", "source", "fromsystem", "frequency", "objectid", "shape_leng", "shape_area" };
+
+        string baseDir = AppDomain.CurrentDomain.BaseDirectory;
+
+        private PostgreHelper _dbHelper;
+
+        private List<TabInfo> _list;
+
+        public FrmEtown()
+        {
+            InitializeComponent();
+            this.Load += new System.EventHandler(this.FrmMyBatisPlus_Load);
+        }
+
+        private void FrmMyBatisPlus_Load(object sender, EventArgs e)
+        {
+            _dbHelper = new PostgreHelper(DbEnum.langfang);
+        }
+        #endregion
+
+        #region 鏌ヨ琛ㄧ粨鏋勶細
+        private void btnReadTab_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                string tabName = this.txtTabPre.Text.Trim();
+                string tabFilter = string.IsNullOrEmpty(tabName) ? "" : string.Format("and c.relname like '{0}%'", tabName);
+
+                string sql = string.Format("select c.relname \"tab\", cast(obj_description(c.oid) as varchar) \"desc\", a.attnum \"num\", a.attname \"col\", t.typname \"type\", d.description \"bak\" from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and relnamespace in ({0}) {1} and position('pg.dropped' in a.attname) = 0 order by c.relname desc, a.attnum asc", this.txtTabNS.Text.Trim(), tabFilter);
+
+                DataTable dt = _dbHelper.GetDataTable(sql, null);
+                _list = ModelHandler.FillModel<TabInfo>(dt);
+                if (_list == null || _list.Count == 0)
+                {
+                    MessageBox.Show("娌℃湁鏌ヨ鍒版暟鎹紒");
+                    return;
+                }
+
+                List<string> tabList = new List<string>();
+                foreach (TabInfo ti in _list)
+                {
+                    if (!tabList.Contains(ti.tab))
+                    {
+                        tabList.Add(ti.tab);
+                    }
+                }
+                this.tabList.DataSource = tabList;
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+
+        private void btnAll_Click(object sender, EventArgs e)
+        {
+            for (int i = 0; i < this.tabList.Items.Count; i++)
+            {
+                this.tabList.SetSelected(i, true);
+            }
+        }
+
+        private void btnAnti_Click(object sender, EventArgs e)
+        {
+            for (int i = 0; i < this.tabList.Items.Count; i++)
+            {
+                bool flag = this.tabList.GetSelected(i);
+                this.tabList.SetSelected(i, !flag);
+            }
+        }
+
+        private void btnNone_Click(object sender, EventArgs e)
+        {
+            for (int i = 0; i < this.tabList.Items.Count; i++)
+            {
+                this.tabList.SetSelected(i, false);
+            }
+        }
+
+        private void tabList_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            string tab = this.tabList.SelectedItem as string;
+            List<TabInfo> tabs = (from p in _list where p.tab == tab orderby p.num select p).ToList<TabInfo>();
+
+            this.dgvTab.DataSource = new BindingList<TabInfo>(tabs);
+            if (tabs != null && tabs.Count > 1)
+            {
+                this.dgvTab.Rows[1].Selected = true;
+                this.dgvTab.CurrentCell = this.dgvTab.Rows[1].Cells[0];
+            }
+        }
+        #endregion
+
+        #region 鎸夐挳浜嬩欢
+        private void btnGeneMapper_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                string path = Path.Combine(baseDir, "EtownTemplate\\Mapper");
+
+                List<string> names = GetTabList();
+                foreach (string name in names)
+                {
+                    List<TabInfo> tabs = GetTabInfo(name);
+                    GenerateMapper(path, name, tabs);
+                }
+
+                OpenFolder(path);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+
+        private void btnGeneEntity_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                string path = Path.Combine(baseDir, "EtownTemplate\\Entity");
+
+                List<string> names = GetTabList();
+                foreach (string name in names)
+                {
+                    List<TabInfo> tabs = GetTabInfo(name);
+                    GenerateEntity(path, name, tabs);
+                }
+
+                OpenFolder(path);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+        #endregion
+
+        #region 鐢熸垚 Mapper
+        private void GenerateMapper(string path, string name, List<TabInfo> tabs)
+        {
+            if (!Directory.Exists(path)) Directory.CreateDirectory(path);
+
+            string tabName = this.txtTabPrefix.Text.Trim() + name;
+            string shortName = GetEntityName(name, true);
+
+            string mapperNS = this.txtMapperNS.Text.Trim();
+            string mapperName = shortName + "Mapper";
+
+            string entityNS = this.txtEntityNS.Text.Trim();
+            string entityName = shortName + "Entity";
+
+            string ns = this.txtTabPrefix.Text.Trim();
+            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("琛�", "");
+
+            string javaFile = "Mapper.java";
+            string xml = File.ReadAllText(Path.Combine(baseDir, "EtownTemplate\\" + javaFile));
+            xml = xml
+                .Replace("{mapperNS}", mapperNS)
+                .Replace("{mapperName}", mapperName)
+                .Replace("{entityNS}", entityNS)
+                .Replace("{entityName}", entityName)
+                .Replace("{ns}", ns)
+                .Replace("{bak}", bak)
+                .Replace("{date}", DateTime.Now.ToString("yyyy-MM-dd"));
+
+            string fileName = shortName + "Mapper.java";
+            File.WriteAllText(Path.Combine(path, fileName), xml);
+        }
+        #endregion
+
+        #region 鐢熸垚 Entity
+        private void GenerateEntity(string path, string name, List<TabInfo> tabs)
+        {
+            if (!Directory.Exists(path)) Directory.CreateDirectory(path);
+
+            string tabName = this.txtTabPrefix.Text.Trim() + name;
+            //string shortName = NameConvert(name, true);
+            string shortName = GetEntityName(name, true);
+
+            string entityNS = this.txtEntityNS.Text.Trim();
+            string entityName = shortName + "Entity";
+
+            string ns = this.txtTabPrefix.Text.Trim();
+            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("琛�", "");
+            long uid = (long)Math.Floor((new Random()).NextDouble() * 1000000000000000000D);
+
+            string javaFile = "Entity.java";
+            string xml = File.ReadAllText(Path.Combine(baseDir, "EtownTemplate\\" + javaFile));
+            xml = xml
+                .Replace("{entityNS}", entityNS)
+                .Replace("{entityName}", entityName)
+                .Replace("{bak}", bak)
+                .Replace("{tabName}", tabName)
+                .Replace("{ns}", ns)
+                .Replace("{uid}", uid.ToString())
+                .Replace("{date}", DateTime.Now.ToString("yyyy-MM-dd"));
+
+            StringBuilder sb = new StringBuilder();
+            foreach (TabInfo ti in tabs)
+            {
+                string type = GetJavaType(ti);
+                if (excludes.Contains(ti.col)) continue;
+                if (ti.col == "class")
+                {
+                    MessageBox.Show(ti.tab + "." + ti.col);
+                    return;
+                }
+
+                sb.Append("\r\n");
+                string colName = NameConvert(ti.col, false);
+                if ("references" == colName) sb.Append("    @TableField(value = \"\\\"references\\\"\")").Append("\r\n");
+                sb.Append("    private " + type + " " + colName + ";\r\n");
+            }
+            sb.Append("\r\n    public " + entityName + "() {\r\n    }\r\n");
+
+            foreach (TabInfo ti in tabs)
+            {
+                if (excludes.Contains(ti.col)) continue;
+
+                string type = GetJavaType(ti);
+                string col1 = NameConvert(ti.col, true);
+                string col2 = NameConvert(ti.col, false);
+
+                sb.Append("\r\n    public " + type + " get" + col1 + "() {\r\n        return " + col2 + ";\r\n    }\r\n");
+                sb.Append("\r\n    public void set" + col1 + "(" + type + " " + col2 + ") {\r\n        this." + col2 + " = " + col2 + ";\r\n    }\r\n");
+            }
+            sb.Append("}\r\n");
+            sb.Insert(0, xml);
+
+            string fileName = shortName + "Entity.java";
+            File.WriteAllText(Path.Combine(path, fileName), sb.ToString());
+        }
+        #endregion
+
+        #region 鐢熸垚鎵�鏈�
+        private void btnGeneAll_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                string mapperPath = Path.Combine(baseDir, "EtownTemplate\\Mapper");
+                string entityPath = Path.Combine(baseDir, "EtownTemplate\\Entity");
+
+                List<string> names = GetTabList();
+                foreach (string name in names)
+                {
+                    List<TabInfo> tabs = GetTabInfo(name);
+                    GenerateMapper(mapperPath, name, tabs);
+                    GenerateEntity(entityPath, name, tabs);
+                }
+
+                string path = Path.Combine(baseDir, "EtownTemplate");
+                OpenFolder(path);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+
+        private void txtTabPrefix_TextChanged(object sender, EventArgs e)
+        {
+            txtChanged(sender, e);
+        }
+
+        private void txtNS_TextChanged(object sender, EventArgs e)
+        {
+            txtChanged(sender, e);
+        }
+
+        private void txtChanged(object sender, EventArgs e)
+        {
+            string pre = txtTabPrefix.Text.Replace(".", "").Trim();
+            txtMapperNS.Text = "com.smartearth.system.mapper.sd".Replace("sd", pre).Replace("sd", pre);
+            txtEntityNS.Text = "com.smartearth.system.domain.sd".Replace("sd", pre).Replace("sd", pre);
+        }
+        #endregion
+
+        #region 鍏叡鏂规硶
+        private List<string> GetTabList()
+        {
+            List<string> list = new List<string>();
+            for (int i = 0, c = this.tabList.SelectedItems.Count; i < c; i++)
+            {
+                string item = this.tabList.SelectedItems[i] as String;
+                if (!string.IsNullOrEmpty(item))
+                {
+                    list.Add(item);
+                }
+            }
+
+            return list;
+        }
+
+        private List<TabInfo> GetTabInfo(string name)
+        {
+            List<TabInfo> tabs = (from p in _list where p.tab == name orderby p.num select p).ToList<TabInfo>();
+
+            return tabs;
+        }
+
+        private static string GetEntityName(string name, bool firstUpper)
+        {
+            return firstUpper ? ToUpperFirst(name.Replace("_", "")) : name.Replace("_", "");
+        }
+
+        private static string NameConvert(string name, bool firstUpper)
+        {
+            string[] strs = name.Split(new char[] { '_' });
+
+            for (int i = 0, c = strs.Length; i < c; i++)
+            {
+                if (0 == i && !firstUpper)
+                {
+                    continue;
+                }
+
+                strs[i] = char.IsDigit(strs[i][0]) ? "_" + strs[i] : ToUpperFirst(strs[i]);
+            }
+
+            return string.Join("", strs);
+        }
+
+        public static string ToUpperFirst(string str)
+        {
+            return Regex.Replace(str, @"^\w", t => t.Value.ToUpper());
+        }
+
+        private string GetJavaType(TabInfo ti)
+        {
+            switch (ti.type)
+            {
+                case "timestamptz":
+                case "timestamp":
+                    return "Timestamp";
+                case "date":
+                    return "LocalDate";
+                case "time":
+                    return "LocalTime";
+                case "float4": // float
+                    return "Float";
+                case "float8": // double
+                    return "Double";
+                case "bool": // boolean
+                    return "Boolean";
+                case "numeric":
+                    return "BigDecimal";
+                case "int8": // long
+                    return "Long";
+                case "int2":
+                case "int4": // int
+                    return "Integer";
+                default: // text, varchar
+                    return "String";
+            }
+        }
+
+        private bool HasGeom(List<TabInfo> tabs)
+        {
+            foreach (TabInfo ti in tabs)
+            {
+                if (ti.col == "geom") return true;
+            }
+
+            return false;
+        }
+
+        private static void OpenFolder(string folderPath)
+        {
+            if (string.IsNullOrEmpty(folderPath)) return;
+
+            Process process = new Process();
+            ProcessStartInfo psi = new ProcessStartInfo("Explorer.exe");
+            psi.Arguments = folderPath;
+            process.StartInfo = psi;
+
+            try
+            {
+                process.Start();
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                process.Close();
+            }
+        }
+        #endregion
+    }
+}
diff --git a/JavaCode/FrmEtown.resx b/JavaCode/FrmEtown.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/JavaCode/FrmEtown.resx
@@ -0,0 +1,120 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file
diff --git a/JavaCode/FrmMain.Designer.cs b/JavaCode/FrmMain.Designer.cs
index 9500c0d..10c1a9b 100644
--- a/JavaCode/FrmMain.Designer.cs
+++ b/JavaCode/FrmMain.Designer.cs
@@ -33,6 +33,7 @@
             this.btnQGis = new System.Windows.Forms.Button();
             this.btnTerrain = new System.Windows.Forms.Button();
             this.btnSEM = new System.Windows.Forms.Button();
+            this.btnEtown = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // btnSys
@@ -90,11 +91,23 @@
             this.btnSEM.UseVisualStyleBackColor = true;
             this.btnSEM.Click += new System.EventHandler(this.btnSEM_Click);
             // 
+            // btnEtown
+            // 
+            this.btnEtown.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnEtown.Location = new System.Drawing.Point(143, 303);
+            this.btnEtown.Name = "btnEtown";
+            this.btnEtown.Size = new System.Drawing.Size(183, 25);
+            this.btnEtown.TabIndex = 18;
+            this.btnEtown.Text = "鐢� 鎴� 浜� 搴� 浠� 鐮�";
+            this.btnEtown.UseVisualStyleBackColor = true;
+            this.btnEtown.Click += new System.EventHandler(this.btnEtown_Click);
+            // 
             // FrmMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(468, 319);
+            this.ClientSize = new System.Drawing.Size(468, 371);
+            this.Controls.Add(this.btnEtown);
             this.Controls.Add(this.btnSEM);
             this.Controls.Add(this.btnTerrain);
             this.Controls.Add(this.btnQGis);
@@ -114,5 +127,6 @@
         private System.Windows.Forms.Button btnQGis;
         private System.Windows.Forms.Button btnTerrain;
         private System.Windows.Forms.Button btnSEM;
+        private System.Windows.Forms.Button btnEtown;
     }
 }
\ No newline at end of file
diff --git a/JavaCode/FrmMain.cs b/JavaCode/FrmMain.cs
index b4fbbc3..bcc44e7 100644
--- a/JavaCode/FrmMain.cs
+++ b/JavaCode/FrmMain.cs
@@ -45,5 +45,10 @@
             FrmSEM sem = new FrmSEM();
             sem.Show();
         }
+
+        private void btnEtown_Click(object sender, EventArgs e)
+        {
+
+        }
     }
 }
diff --git a/JavaCode/JavaCode.csproj b/JavaCode/JavaCode.csproj
index 5e8a35b..3027ff6 100644
--- a/JavaCode/JavaCode.csproj
+++ b/JavaCode/JavaCode.csproj
@@ -115,6 +115,12 @@
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="FrmEtown.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FrmEtown.Designer.cs">
+      <DependentUpon>FrmEtown.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="FrmMain.resx">
       <DependentUpon>FrmMain.cs</DependentUpon>
       <SubType>Designer</SubType>
@@ -139,6 +145,9 @@
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
     </Compile>
+    <EmbeddedResource Include="FrmEtown.resx">
+      <DependentUpon>FrmEtown.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -172,6 +181,12 @@
     <Content Include="DLL\NPOI.dll" />
     <Content Include="DLL\SQLite.Interop.dll" />
     <Content Include="DLL\System.Data.SQLite.dll" />
+    <EmbeddedResource Include="EtownTemplate\Entity.java">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </EmbeddedResource>
+    <EmbeddedResource Include="EtownTemplate\Mapper.java">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </EmbeddedResource>
     <Content Include="SysTemplate\pg.sql" />
     <EmbeddedResource Include="SysTemplate\Controller.java">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
diff --git a/JavaCode/cs/PostgreHelper.cs b/JavaCode/cs/PostgreHelper.cs
index ef88f93..b417a57 100644
--- a/JavaCode/cs/PostgreHelper.cs
+++ b/JavaCode/cs/PostgreHelper.cs
@@ -15,9 +15,7 @@
     {
         langfang = 0,
 
-        postgis = 1,
-
-        postgres = 2
+        etown = 1
     }
 
     /// <summary>
@@ -31,7 +29,16 @@
 
         public PostgreHelper(DbEnum db)
         {
-            string str = ConfigurationManager.AppSettings["pgConn"];
+            string str = null;
+            switch (db)
+            {
+                case DbEnum.langfang:
+                    str = ConfigurationManager.AppSettings["pgConn"];
+                    break;
+                case DbEnum.etown:
+                    str = ConfigurationManager.AppSettings["etownConn"];
+                    break;
+            }
 
             this.conStr = string.Format(str, db.ToString());
         }

--
Gitblit v1.9.3