管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-07-31 a983f160ca0581c55066902ae5d3716e2a25e5e2
JavaCode/FrmMyBatisPlus.cs
@@ -17,7 +17,7 @@
    public partial class FrmMyBatisPlus : Form
    {
        #region 成员变量+构造函数
        private static List<string> excludes = new List<string>() { "gid", "objectid", "eventid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "geom", "shape_leng", "shape_area" };
        private static List<string> excludes = new List<string>() { "gid", "parentid", "objectid", "eventid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "geom", "shape_leng", "shape_area" };
        string baseDir = AppDomain.CurrentDomain.BaseDirectory;
@@ -44,7 +44,7 @@
                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} order by c.relname desc, a.attnum asc", this.txtNS.Text.Trim(), tabFilter);
                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.txtNS.Text.Trim(), tabFilter);
                DataTable dt = _dbHelper.GetDataTable(sql, null);
                _list = ModelHandler.FillModel<TabInfo>(dt);
@@ -194,6 +194,7 @@
            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("表", "");
            //if (this.HasGeom(tabs)) return;
            string javaFile = this.HasGeom(tabs) ? "GeoMapper.java" : "Mapper.java";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\" + javaFile));
            xml = xml
@@ -223,6 +224,7 @@
            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("表", "");
            long uid = (long)Math.Floor((new Random()).NextDouble() * 1000000000000000000D);
            //if (this.HasGeom(tabs)) return;
            string javaFile = this.HasGeom(tabs) ? "GeoEntity.java" : "Entity.java";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\" + javaFile));
            xml = xml
@@ -247,7 +249,7 @@
                    //sb.Append("\r\n    @TableField(value = \"class\")");
                    //ti.col = "clazz";
                    //ti.col = "classes";
                    MessageBox.Show(ti.tab);
                    MessageBox.Show(ti.tab + "." + ti.col);
                    return;
                }
@@ -318,6 +320,10 @@
                str += strs[i].Length == 1 ? strs[i] : ToUpperFirst(strs[i]);
            }
            if (str.Length == 1 && firstUpper)
            {
                return str.ToUpper();
            }
            return str;
        }
@@ -331,8 +337,13 @@
        {
            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
@@ -346,7 +357,7 @@
                case "int2":
                case "int4": // int
                    return "Integer";
                default:
                default: // text, varchar
                    return "String";
            }
        }