From 789027cd17a31a439efeef8ba1ef61705ba43edc Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 12 十一月 2022 08:55:41 +0800 Subject: [PATCH] 1 --- JavaCode/FrmSys.cs | 5 +- Community.DAL/QueryDAL.cs | 11 +---- Community.Serve/App_Data/CommunityAll.db | 0 JavaCode/BsTemplate/GeoMapper.java | 15 +++++++ JavaCode/BsTemplate/Mapper.java | 1 Community.Serve/Global.asax.cs | 4 + Community.Serve/App_Data/Community.db | 0 Community.Serve/Web.config | 4 + JavaCode/FrmMyBatisPlus.cs | 23 ++++------- JavaCode/JavaCode.csproj | 3 + 10 files changed, 37 insertions(+), 29 deletions(-) diff --git a/Community.DAL/QueryDAL.cs b/Community.DAL/QueryDAL.cs index fe9d2d5..283bd91 100644 --- a/Community.DAL/QueryDAL.cs +++ b/Community.DAL/QueryDAL.cs @@ -34,16 +34,9 @@ public static DataTable QueryBuildingById(int id) { - try - { - string sql = string.Format(_queryBuilding, id); + string sql = string.Format(_queryBuilding, id); - return SQLiteHelper.GetDataTable(sql, null); - } - catch - { - return null; - } + return SQLiteHelper.GetDataTable(sql, null); } public static DataTable QueryHouse(string name, string unit, string num) diff --git a/Community.Serve/App_Data/Community.db b/Community.Serve/App_Data/Community.db index bd84482..224e025 100644 --- a/Community.Serve/App_Data/Community.db +++ b/Community.Serve/App_Data/Community.db Binary files differ diff --git a/Community.Serve/App_Data/CommunityAll.db b/Community.Serve/App_Data/CommunityAll.db new file mode 100644 index 0000000..bd84482 --- /dev/null +++ b/Community.Serve/App_Data/CommunityAll.db Binary files differ diff --git a/Community.Serve/Global.asax.cs b/Community.Serve/Global.asax.cs index 8ba0d62..a7bda13 100644 --- a/Community.Serve/Global.asax.cs +++ b/Community.Serve/Global.asax.cs @@ -7,6 +7,7 @@ using System.Web; using System.Web.Http; using System.Web.Routing; +using System.Configuration; namespace Community.Serve { @@ -14,7 +15,8 @@ { protected void Application_Start() { - SQLiteHelper.DB = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin\\App_Data\\Community.db"); + //SQLiteHelper.DB = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin\\App_Data\\Community.db"); + SQLiteHelper.DB = ConfigurationManager.AppSettings["db"]; GlobalConfiguration.Configure(WebApiConfig.Register); } diff --git a/Community.Serve/Web.config b/Community.Serve/Web.config index 87bbd72..b0865fc 100644 --- a/Community.Serve/Web.config +++ b/Community.Serve/Web.config @@ -1,6 +1,8 @@ 锘�<?xml version="1.0"?> <configuration> - <appSettings/> + <appSettings> + <add key="db" value="E:\terrait\CommunityServe\Community.Serve\App_Data\Community.db"/> + </appSettings> <system.web> <compilation debug="true" targetFramework="4.5.2"/> <httpRuntime/> diff --git a/JavaCode/BsTemplate/GeoMapper.java b/JavaCode/BsTemplate/GeoMapper.java new file mode 100644 index 0000000..3769593 --- /dev/null +++ b/JavaCode/BsTemplate/GeoMapper.java @@ -0,0 +1,15 @@ +package {mapperNS}; + +import {entityNS}.{entityName}; +import com.lf.server.mapper.all.GeomBaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + * {bak} + * @author WWW + */ +@Mapper +@Repository +public interface {mapperName} extends GeomBaseMapper<{entityName}> { +} diff --git a/JavaCode/BsTemplate/Mapper.java b/JavaCode/BsTemplate/Mapper.java index 2e931d9..ee6e7d4 100644 --- a/JavaCode/BsTemplate/Mapper.java +++ b/JavaCode/BsTemplate/Mapper.java @@ -14,5 +14,4 @@ @Mapper @Repository public interface {mapperName} extends BaseMapper<{entityName}> { -{wkt} } diff --git a/JavaCode/FrmMyBatisPlus.cs b/JavaCode/FrmMyBatisPlus.cs index 4abbf6c..0096153 100644 --- a/JavaCode/FrmMyBatisPlus.cs +++ b/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; diff --git a/JavaCode/FrmSys.cs b/JavaCode/FrmSys.cs index 5632b57..a803972 100644 --- a/JavaCode/FrmSys.cs +++ b/JavaCode/FrmSys.cs @@ -548,7 +548,8 @@ string queryCol = colType + " " + colName; //string where = isString ? "\r\n " + colName + " = \"%\" + (StringHelper.isNull(" + colName + ") ? \"\" : " + colName + ".trim()) + \"%\";\r\n" : ""; - string where = colType == "String" ? "\r\n " + colName + " = StringHelper.isNull(" + colName + ") ? null : \"%\" + " + colName + ".trim() + \"%\";\r\n" : ""; + //string where = colType == "String" ? "\r\n " + colName + " = StringHelper.isNull(" + colName + ") ? null : \"%\" + " + colName + ".trim() + \"%\";\r\n" : ""; + string where = colType == "String" ? "\r\n " + colName + " = StringHelper.getLikeStr(" + colName + ");\r\n" : ""; string xml = File.ReadAllText(Path.Combine(baseDir, "SysTemplate\\Service.java")); xml = xml @@ -562,7 +563,7 @@ .Replace("{bak}", bak) .Replace("{queryCol}", queryCol) .Replace("{colName}", colName) - .Replace("{where}", where); + .Replace("{where}", where); string path = Path.Combine(baseDir, "SysGenerate"); if (!Directory.Exists(path)) diff --git a/JavaCode/JavaCode.csproj b/JavaCode/JavaCode.csproj index f7ab109..0fa3b47 100644 --- a/JavaCode/JavaCode.csproj +++ b/JavaCode/JavaCode.csproj @@ -118,6 +118,9 @@ <EmbeddedResource Include="BsTemplate\Mapper.java"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> + <EmbeddedResource Include="BsTemplate\GeoMapper.java"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </EmbeddedResource> <Content Include="DLL\Mono.Security.dll" /> <Content Include="DLL\Npgsql.dll" /> <Content Include="SysTemplate\pg.sql" /> -- Gitblit v1.9.3