1
13693261870
2022-11-12 789027cd17a31a439efeef8ba1ef61705ba43edc
JavaCode/FrmMyBatisPlus.cs
@@ -34,7 +34,6 @@
        }
        #endregion
        #region 查询表结构:135502,69701  29257,20582
        private void btnReadTab_Click(object sender, EventArgs e)
        {
@@ -192,23 +191,13 @@
            string bak = string.IsNullOrWhiteSpace(tabs[0].desc) ? shortName : tabs[0].desc.Replace("表", "");
            string wkt = this.HasGeom(tabs) ?
                    "    /**\r\n" +
                    "     * 根据ID查询WKT\r\n" +
                    "     *\r\n" +
                    "     * @param gid\r\n" +
                    "     * @return\r\n" +
                    "     */\r\n" +
                    "    @Select(\"select st_astext(geom) geom from " + tabName + " where gid = #{gid}\")\r\n" +
                    "    String selectWktById(@Param(\"gid\") Integer gid);" : "";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\Mapper.java"));
            string javaFile = this.HasGeom(tabs) ? "GeoMapper.java" : "Mapper.java";
            string xml = File.ReadAllText(Path.Combine(baseDir, "BsTemplate\\" + javaFile));
            xml = xml
                .Replace("{mapperNS}", mapperNS)
                .Replace("{mapperName}", mapperName)
                .Replace("{entityNS}", entityNS)
                .Replace("{entityName}", entityName)
                .Replace("{wkt}", wkt)
                .Replace("{bak}", bak);
            string fileName = shortName + "Mapper.java";
@@ -243,7 +232,10 @@
            {
                string type = GetJavaType(ti);
                if (ti.col == "gid") sb.Append("\r\n    @TableId(type = IdType.AUTO)");
                if (ti.col == "geom") sb.Append("\r\n    @TableField(select = false)");
                if (ti.col == "geom" || ti.col == "shape_leng" || ti.col == "shape_area")
                {
                    sb.Append("\r\n    @TableField(select = false)");
                }
                if (ti.col == "class")
                {
                    sb.Append("\r\n    @TableField(value = \"class\")");
@@ -307,7 +299,8 @@
                    str += strs[i];
                    continue;
                }
                str += ToUpperFirst(strs[i]);
                str += strs[i].Length == 1 ? strs[i] : ToUpperFirst(strs[i]);
            }
            return str;