| | |
| | | select distinct ns,tab,fn_get_entity(tab) entity,tab_desc,tabletype from lf.sys_dict order by tab; |
| | | |
| | | -- 3248:POINT(95.8046 34.1386) |
| | | select * from bd.dlg_agnp; |
| | | select count(*) from bd.dlg_agnp; |
| | | delete from bd.dlg_agnp; |
| | | select ST_AsText(geom) from bd.dlg_agnp limit 1; |
| | | |
| | | -- 7348:MULTILINESTRING((113.6007 6.9434,113.6015 6.9444,113.6007 6.9434)) |
| | | select * from bd.dlg_25w_boul; |
| | | select count(*) from bd.dlg_25w_boul; |
| | | delete from bd.dlg_25w_boul; |
| | | select ST_AsText(geom) from bd.dlg_25w_boul limit 1; |
| | | |
| | | -- 156847:MULTIPOLYGON(((108.6790 19.0108,108.6791 19.0104,108.6796 19.0104,108.6790 19.0108))) |
| | | select * from bd.dlg_25w_resa; |
| | | select count(*) from bd.dlg_25w_resa; |
| | | delete from bd.dlg_25w_resa; |
| | | select ST_AsText(geom) from bd.dlg_25w_resa limit 1; |
| | | |
| | | select * from lf.sys_attach where tab = 'lf.sys_style' and guid = 'fa25979a5ef8b43ba82a0be35b3fb0d4' |
| | | -- MultiLineString MultiPolygon Point |
| | | select GeometryType(geom) from bd.dlg_25w_boul; |
| | | select st_srid(geom) from bd.dlg_25w_boul limit 1; |
| | | |
| | | select * from lf.sys_dict where ns='bd' and tab='dlg_25w_boul' and field='geom'; |
| | | |
| | | |
| | | |
| | |
| | | package com.lf.server.extend; |
| | | |
| | | import com.baomidou.mybatisplus.core.injector.AbstractMethod; |
| | | import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; |
| | | import com.baomidou.mybatisplus.core.metadata.TableInfo; |
| | | import com.lf.server.helper.GdbHelper; |
| | | import org.apache.ibatis.executor.keygen.NoKeyGenerator; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.mapping.SqlSource; |
| | |
| | | |
| | | private String prepareFieldSql(TableInfo tableInfo) { |
| | | StringBuilder fieldSql = new StringBuilder(); |
| | | fieldSql.append(tableInfo.getKeyColumn()).append(","); |
| | | tableInfo.getFieldList().forEach(x -> { |
| | | fieldSql.append(x.getColumn()).append(","); |
| | | }); |
| | | // fieldSql.append(tableInfo.getKeyColumn()).append(",") |
| | | // tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")) |
| | | for (TableFieldInfo f : tableInfo.getFieldList()) { |
| | | if (GdbHelper.excludeFields.contains(f.getColumn())) { |
| | | continue; |
| | | } |
| | | |
| | | fieldSql.append(f.getColumn()).append(","); |
| | | } |
| | | |
| | | fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); |
| | | fieldSql.insert(0, "("); |
| | |
| | | private String prepareValuesSql(TableInfo tableInfo) { |
| | | final StringBuilder valueSql = new StringBuilder(); |
| | | valueSql.append("<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">"); |
| | | valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},"); |
| | | tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},")); |
| | | // valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},") |
| | | // tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},")) |
| | | for (TableFieldInfo f : tableInfo.getFieldList()) { |
| | | if (GdbHelper.excludeFields.contains(f.getColumn())) { |
| | | continue; |
| | | } |
| | | |
| | | valueSql.append("geom".equals(f.getColumn()) ? "${item." : "#{item.").append(f.getProperty()).append("},"); |
| | | } |
| | | |
| | | valueSql.delete(valueSql.length() - 1, valueSql.length()); |
| | | valueSql.append("</foreach>"); |
| | | |
| | |
| | | public class GdbHelper { |
| | | private final static Log log = LogFactory.getLog(GdbHelper.class); |
| | | |
| | | public static List<String> excludeFields = new ArrayList<String>(); |
| | | |
| | | static { |
| | | excludeFields.add("gid"); |
| | | excludeFields.add("shape_leng"); |
| | | } |
| | | |
| | | /** |
| | | * 获取表名 |
| | | */ |
| | |
| | | FieldDefn fieldDefn = fd.GetFieldDefn(i); |
| | | try { |
| | | String name = fieldDefn.GetName().toLowerCase(); |
| | | if ("gid".equals(name)) { |
| | | if (excludeFields.contains(name)){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 设置 geom 字段值 |
| | | * |
| | | * <p> |
| | | * wkbUnknown = 0, |
| | | * wkbPoint = 1, |
| | | * wkbLineString = 2, |
| | |
| | | String wkt = geometry.ExportToWkt(); |
| | | switch (geometry.GetGeometryType()) { |
| | | case 2: |
| | | wkt = wkt.replace("LINESTRING (", "MultiLINESTRING ((") + ")"; |
| | | wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")"; |
| | | break; |
| | | case 3: |
| | | wkt = wkt.replace("POLYGON (", "LINESTRINGPOLYGON ((") + ")"; |
| | | wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import org.apache.commons.text.StringEscapeUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | String filePath = StringEscapeUtils.escapeJava(root + File.separator + tab.getSubPath()); |
| | | List<?> list = null; |
| | | switch (type) { |
| | | case "shp": |
| | | list = ShpHelper.readData(clazz, root + File.separator + tab.getSubPath()); |
| | | list = ShpHelper.readData(clazz, filePath); |
| | | break; |
| | | case "gdb": |
| | | list = GdbHelper.readData(clazz, root + File.separator + tab.getSubPath(), tab.getTab()); |
| | | list = GdbHelper.readData(clazz, filePath, tab.getTab()); |
| | | break; |
| | | case "mdb": |
| | | list = MdbHelper.readData(clazz, root + File.separator + tab.getSubPath(), tab.getTab()); |
| | | list = MdbHelper.readData(clazz, filePath, tab.getTab()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | setCreateInfo(list, mfe); |
| | | |
| | | Integer rows = basicMapper.insertBatch(list); |
| | | if (basicMapper instanceof GeomBaseMapper) { |
| | | updateDbGeom((GeomBaseMapper) basicMapper, list); |
| | | } |
| | | |
| | | tab.setRows(rows); |
| | | } |