Browse Source

Merge branch 'dev' of http://114.244.114.158:8802/siwei/sanya-data-management-back into dev

gushoubang 8 months ago
parent
commit
01d84c76b4

+ 10 - 10
onemap-modules/onemap-analyse/src/main/resources/mapper/oracle/vector/TableDateMapper.xml

@@ -5,16 +5,16 @@
 <mapper namespace="com.onemap.analyse.mapper.vector.TableDataMapper">
     <select id="getRawTable" resultType="Map">
         SELECT
-        <foreach item="column" collection="columns" separator=",">
-            <choose>
-                <when test="column == 'geom'">
-                    public.st_asewkt(${column}) AS geom
-                </when>
-                <otherwise>
-                    ${column}
-                </otherwise>
-            </choose>
-        </foreach>
+        public.st_asewkt(geom) AS geom
+        <if test="columns != null and columns!='' ">
+            <foreach item="column" collection="columns">
+                <choose>
+                    <when test="column != 'geom'">
+                        ,${column}
+                    </when>
+                </choose>
+            </foreach>
+        </if>
         <if test="siweiArea == true">
             , public.st_area(
             <choose>

+ 10 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/table/TableDataSelectController.java

@@ -18,9 +18,17 @@ public class TableDataSelectController extends BaseController {
 
     @GetMapping("/GetTableData")
     public RequestResult GetTestList(String wkt, String id) {
-//        String id = "fa10c8ee6c3c499ea6e09438eeeb18af";
-//        String wkt = "SRID=4326;POINT(109.5139541 18.3146153)";
         return RequestResult.success(tableDataSelectService.dataSelectByPoint(Srid4326 + wkt, id));
     }
 
+    @GetMapping("/point/GetTableData")
+    public RequestResult GetTestList(String sourcePointWkt, String sourceLayerId, String sourceLayerType, String queryTableId) {
+        return RequestResult.success(tableDataSelectService.dataQueryByPoint(Srid4326 + sourcePointWkt, sourceLayerId, sourceLayerType, queryTableId));
+    }
+
+    @GetMapping("/query/layer")
+    public RequestResult queryLayerList(String defaultType,String layerId) {
+        return RequestResult.success(tableDataSelectService.dataQueryLayer(defaultType,layerId));
+    }
+
 }

+ 84 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/table/TableLayerDTO.java

@@ -0,0 +1,84 @@
+package com.onemap.apply.domain.table;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("t_table_layer")
+public class TableLayerDTO {
+    private String id;
+    private String pid;
+    private String name;
+    @TableField(value = "layer_id")
+    private String layerId;
+    @TableField(value = "table_id")
+    private String tableId;
+    @TableField(value = "default_type")
+    private String defaultType;
+    @TableField(value = "create_time")
+    private String createTime;
+    private String groupcolumn;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getPid() {
+        return pid;
+    }
+
+    public void setPid(String pid) {
+        this.pid = pid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLayerId() {
+        return layerId;
+    }
+
+    public void setLayerId(String layerId) {
+        this.layerId = layerId;
+    }
+
+    public String getTableId() {
+        return tableId;
+    }
+
+    public void setTableId(String tableId) {
+        this.tableId = tableId;
+    }
+
+    public String getDefaultType() {
+        return defaultType;
+    }
+
+    public void setDefaultType(String defaultType) {
+        this.defaultType = defaultType;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getGroupcolumn() {
+        return groupcolumn;
+    }
+
+    public void setGroupcolumn(String groupcolumn) {
+        this.groupcolumn = groupcolumn;
+    }
+}

+ 44 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/table/TableLayerJgTempDTO.java

@@ -0,0 +1,44 @@
+package com.onemap.apply.domain.table;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("t_table_layer_jg_temp")
+public class TableLayerJgTempDTO {
+    private String id;
+    private String groupvalue;
+    private String sumvalue;
+    private String geomvalue;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getGroupvalue() {
+        return groupvalue;
+    }
+
+    public void setGroupvalue(String groupvalue) {
+        this.groupvalue = groupvalue;
+    }
+
+    public String getSumvalue() {
+        return sumvalue;
+    }
+
+    public void setSumvalue(String sumvalue) {
+        this.sumvalue = sumvalue;
+    }
+
+    public String getGeomvalue() {
+        return geomvalue;
+    }
+
+    public void setGeomvalue(String geomvalue) {
+        this.geomvalue = geomvalue;
+    }
+}

+ 17 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/table/TableLayerJgTempMapper.java

@@ -0,0 +1,17 @@
+package com.onemap.apply.mapper.table;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.table.TableLayerJgTempDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface TableLayerJgTempMapper extends BaseMapper<TableLayerJgTempDTO> {
+
+    int insertTableLayerJgTempList(@Param("dtoList") List<TableLayerJgTempDTO> dtoList);
+
+    List<Map> queryTableLayerJgTempList(@Param("id") String id);
+}

+ 10 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/table/TableLayerMapper.java

@@ -0,0 +1,10 @@
+package com.onemap.apply.mapper.table;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.table.TableLayerDTO;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface TableLayerMapper extends BaseMapper<TableLayerDTO> {
+
+}

+ 345 - 21
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/table/TableDataSelectServiceImpl.java

@@ -1,10 +1,7 @@
 package com.onemap.apply.service.impl.table;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.onemap.apply.domain.table.TableDTO;
-import com.onemap.apply.domain.table.TableDataVo;
-import com.onemap.apply.domain.table.TableFiledDTO;
-import com.onemap.apply.domain.table.TableResRuleDTO;
+import com.onemap.apply.domain.table.*;
 import com.onemap.apply.mapper.table.*;
 import com.onemap.apply.service.analyse.HttpAnalyseService;
 import com.onemap.apply.service.table.TableDataSelectService;
@@ -24,6 +21,10 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
     @Resource
     private TableMapper tableMapper;
     @Resource
+    private TableLayerMapper tableLayerMapper;
+    @Resource
+    private TableLayerJgTempMapper tableLayerJgTempMapper;
+    @Resource
     private TableDataSelectMapper tableDataSelectMapper;
     @Resource
     private HttpAnalyseService httpAnalyseService;
@@ -33,6 +34,325 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
     private TableFiledMapper tableFiledMapper;
     private final Integer SRID = 4525;
 
+    /**
+     * @param sourcePointWkt
+     * @param sourceLayerId
+     * @param sourceLayerType 0图层ID 1数据库表id
+     * @param queryTableId
+     * @return
+     */
+    @Override
+    public Map dataQueryByPoint(String sourcePointWkt, String sourceLayerId, String sourceLayerType, String queryTableId) {
+        System.out.println("进入点数据查询");
+        Map<String, Object> retMapData = new HashMap<>();
+        retMapData.put("base", "无数据");
+        if (StringUtils.isEmpty(sourcePointWkt)) {
+            return retMapData;
+        }
+        if (StringUtils.isEmpty(sourceLayerId)) {
+            return retMapData;
+        }
+        if (StringUtils.isEmpty(sourceLayerType)) {
+            return retMapData;
+        }
+        if (StringUtils.isEmpty(queryTableId)) {
+            return retMapData;
+        }
+
+        //查询原始节点数据
+        QueryWrapper<TableLayerDTO> fromTableLayerWrapper = new QueryWrapper<>();
+        if ("0".equals(sourceLayerType)) {
+            fromTableLayerWrapper.eq("layer_id", sourceLayerId);
+        } else if ("1".equals(sourceLayerType)) {
+            fromTableLayerWrapper.eq("table_id", sourceLayerId);
+        } else {
+            return retMapData;
+        }
+        TableLayerDTO fromTableLayerDTO = tableLayerMapper.selectOne(fromTableLayerWrapper);
+        if (fromTableLayerDTO == null) {
+            return retMapData;
+        }
+
+        //查询查询节点数据
+        QueryWrapper<TableLayerDTO> queryTableLayerWrapper = new QueryWrapper<>();
+        queryTableLayerWrapper.eq("table_id", queryTableId);
+        TableLayerDTO queryTableLayerDTO = tableLayerMapper.selectOne(queryTableLayerWrapper);
+        if (queryTableLayerDTO == null) {
+            return retMapData;
+        }
+        retMapData.put("dataname", queryTableLayerDTO.getName());
+
+        //intersects 相交
+        //intersection 交集
+        String uid = StringUtils.getUUID();
+        //查询查询节点的是否有子集
+        QueryWrapper<TableLayerDTO> queryTableLayerPidWrapper = new QueryWrapper<>();
+        queryTableLayerPidWrapper.eq("pid", queryTableLayerDTO.getId());
+        List<TableLayerDTO> TableLayerDTOPid = tableLayerMapper.selectList(queryTableLayerPidWrapper);
+
+
+        if (TableLayerDTOPid == null || TableLayerDTOPid.size() == 0) {
+            List<List<TableDataVo>> retListData = new ArrayList<>();
+            //判断查询节点和源数据节点是否一致,一致代表查询当前节点详情
+            if (fromTableLayerDTO.getId().equals(queryTableLayerDTO.getId())) {
+                List<List<TableDataVo>> ret = queryIntersectsList(sourcePointWkt, queryTableId);
+                if (ret != null && ret.size() > 0) {
+                    retMapData.put("base", null);
+                    insetDataHandleGroup(ret, queryTableLayerDTO.getGroupcolumn(), uid);
+                }
+                retListData.addAll(ret);
+                retMapData.put("data", retListData);
+                retMapData.put("datalist", tableLayerJgTempMapper.queryTableLayerJgTempList(uid));
+            } else {
+                //判断查询节点和源数据节点是否一致,不一致先查询原始节点图层,之后根据图层信息,查询要查询图层的数据
+                List<Map> retListMap = queryIntersectsByPoint(sourcePointWkt, fromTableLayerDTO.getTableId());
+                if (retListMap != null && retListMap.size() > 0) {
+                    for (Map mapData : retListMap) {
+                        String geom = (String) mapData.get("geom");
+                        List<List<TableDataVo>> ret = queryIntersectionList(geom, queryTableLayerDTO.getTableId());
+                        if (ret != null && ret.size() > 0) {
+                            retMapData.put("base", null);
+                            insetDataHandleGroup(ret, queryTableLayerDTO.getGroupcolumn(), uid);
+                        }
+                        retListData.addAll(ret);
+                    }
+                }
+                retMapData.put("data", retListData);
+                retMapData.put("datalist", tableLayerJgTempMapper.queryTableLayerJgTempList(uid));
+            }
+        } else {
+            //判断查询节点和源数据节点是否一致,一致代表查询当前节点详情
+            if (fromTableLayerDTO.getId().equals(queryTableLayerDTO.getId())) {
+//                List<List<TableDataVo>> ret = queryIntersectsList(sourcePointWkt, queryTableId);
+//                if (ret != null && ret.size() > 0) {
+//                    retMapData.put("base", null);
+//                    retMapData.put("datalist", insetDataHandleGroup(ret, queryTableLayerDTO.getGroupcolumn(), uid));
+//                }
+//                retMapData.put("data", ret);
+            } else {
+                //判断查询节点和源数据节点是否一致,不一致先查询原始节点图层,之后根据图层信息,查询要查询图层的数据
+                List<Map> retListMap = queryIntersectsByPoint(sourcePointWkt, fromTableLayerDTO.getTableId());
+                if (retListMap != null && retListMap.size() > 0) {
+                    List child = new ArrayList();
+                    for (TableLayerDTO layerDTO : TableLayerDTOPid) {
+                        String v_uid = StringUtils.getUUID();
+                        List<List<TableDataVo>> retListData = new ArrayList<>();
+                        Map<String, Object> v_d01 = new HashMap<>();
+                        v_d01.put("base", "无数据");
+                        for (Map mapData : retListMap) {
+                            String geom = (String) mapData.get("geom");
+
+                            List<List<TableDataVo>> ret = queryIntersectionList(geom, layerDTO.getTableId());
+                            if (ret != null && ret.size() > 0) {
+                                retMapData.put("base", null);
+                                v_d01.put("base", null);
+                                insetDataHandleGroup(ret, layerDTO.getGroupcolumn(), v_uid);
+                                retListData.addAll(ret);
+                            }
+                        }
+                        v_d01.put("dataname", layerDTO.getName());
+                        v_d01.put("data", retListData);
+                        v_d01.put("datalist", tableLayerJgTempMapper.queryTableLayerJgTempList(v_uid));
+                        child.add(v_d01);
+                    }
+                    retMapData.put("child", child);
+                }
+            }
+        }
+        return retMapData;
+    }
+
+    private void insetDataHandleGroup(List<List<TableDataVo>> tableData, String groupColumn, String uid) {
+        if (StringUtils.isEmpty(groupColumn)) {
+            return;
+        }
+        String[] groupColumns = groupColumn.split(",", -1);
+        if (groupColumns.length < 3) {
+            return;
+        }
+        String groupValue = groupColumns[0];
+        String sumValue = groupColumns[1];
+        String geomValue = groupColumns[2];
+        List<TableLayerJgTempDTO> retList = new ArrayList<>();
+        for (List<TableDataVo> dataVo : tableData) {
+            TableLayerJgTempDTO map = new TableLayerJgTempDTO();
+            map.setId(uid);
+            for (TableDataVo tableVo : dataVo) {
+                if (tableVo.getFiled().equals(groupValue)) {
+                    map.setGroupvalue(tableVo.getData().toString());
+                } else if (tableVo.getFiled().equals(sumValue)) {
+                    map.setSumvalue(tableVo.getData().toString());
+                } else if (tableVo.getFiled().equals(geomValue)) {
+                    map.setGeomvalue(tableVo.getData().toString());
+                }
+            }
+            retList.add(map);
+        }
+        tableLayerJgTempMapper.insertTableLayerJgTempList(retList);
+    }
+
+    //取相交的函数
+    private List<Map> queryIntersectsByPoint(String eWkt, String tableId) {
+        List<Map> retList = new ArrayList<>();
+        // 获取from_table_id
+        QueryWrapper<TableDTO> queryTableTableWrapper = new QueryWrapper<>();
+        queryTableTableWrapper.eq("id", tableId);
+        TableDTO v_table = tableMapper.selectOne(queryTableTableWrapper);
+        if (v_table == null) {
+            return retList;
+        }
+
+        IntersectsTableWktVo intersectsTableWktVo = new IntersectsTableWktVo();
+        intersectsTableWktVo.setEwkt(eWkt);
+        intersectsTableWktVo.setTableName(v_table.getTableName());
+        List<String> from_kj_ids = httpAnalyseService.intersectsTableWkt(intersectsTableWktVo);
+        if (from_kj_ids == null || from_kj_ids.size() <= 0) {
+            return retList;
+        }
+
+        RawTableVo rawTableVo = new RawTableVo();
+        rawTableVo.setRawTableName(v_table.getTableName());
+        rawTableVo.setSrid(SRID);
+        rawTableVo.setIds(from_kj_ids);
+        rawTableVo.setIsGeography(false);
+        rawTableVo.setSiweiArea(true);
+        List<Map> retDataList = httpAnalyseService.rawTable(rawTableVo);
+        if (retDataList == null || retDataList.size() <= 0) {
+            return retList;
+        }
+        return retDataList;
+    }
+
+
+    //取相交的函数
+    private List<List<TableDataVo>> queryIntersectsList(String eWkt, String tableId) {
+        List<List<TableDataVo>> retList = new ArrayList<>();
+        // 获取from_table_id
+        QueryWrapper<TableDTO> queryTableTableWrapper = new QueryWrapper<>();
+        queryTableTableWrapper.eq("id", tableId);
+        TableDTO v_table = tableMapper.selectOne(queryTableTableWrapper);
+        if (v_table == null) {
+            return retList;
+        }
+
+        IntersectsTableWktVo intersectsTableWktVo = new IntersectsTableWktVo();
+        intersectsTableWktVo.setEwkt(eWkt);
+        intersectsTableWktVo.setTableName(v_table.getTableName());
+        List<String> from_kj_ids = httpAnalyseService.intersectsTableWkt(intersectsTableWktVo);
+        if (from_kj_ids == null || from_kj_ids.size() <= 0) {
+            return retList;
+        }
+
+        List<TableFiledDTO> filedlist = getFieldListByTableId(tableId, 0);
+        List<String> outputColumn = new ArrayList<>();
+        for (TableFiledDTO v_data : filedlist) {
+            outputColumn.add(v_data.getFiledName());
+        }
+        RawTableVo rawTableVo = new RawTableVo();
+        rawTableVo.setRawTableName(v_table.getTableName());
+        rawTableVo.setSrid(SRID);
+        rawTableVo.setIds(from_kj_ids);
+        rawTableVo.setIsGeography(false);
+        rawTableVo.setColumns(outputColumn);
+        rawTableVo.setSiweiArea(true);
+        List<Map> retDataList = httpAnalyseService.rawTable(rawTableVo);
+        if (retDataList == null || retDataList.size() <= 0) {
+            return retList;
+        }
+        return dataMapTransFormZh(retDataList, filedlist);
+    }
+
+    //取并集的函数
+    private List<Map> queryIntersectionByPoint(String eWkt, String tableId) {
+        List<Map> retList = new ArrayList<>();
+        // 获取from_table_id
+        QueryWrapper<TableDTO> queryTableTableWrapper = new QueryWrapper<>();
+        queryTableTableWrapper.eq("id", tableId);
+        TableDTO v_table = tableMapper.selectOne(queryTableTableWrapper);
+        if (v_table == null) {
+            return retList;
+        }
+
+        IntersectsTableWktVo intersectsTableWktVo = new IntersectsTableWktVo();
+        intersectsTableWktVo.setEwkt(eWkt);
+        intersectsTableWktVo.setTableName(v_table.getTableName());
+        List<String> from_kj_ids = httpAnalyseService.intersectsTableWkt(intersectsTableWktVo);
+        if (from_kj_ids == null || from_kj_ids.size() == 0) {
+            return retList;
+        }
+
+        IntersectionTableWktVo intersectionTableWktVo = new IntersectionTableWktVo();
+        intersectionTableWktVo.setEwkt(eWkt);
+        intersectionTableWktVo.setTableIds(from_kj_ids);
+        intersectionTableWktVo.setTableName(v_table.getTableName());
+        String from_kj_data = httpAnalyseService.intersectionTableWkt(intersectionTableWktVo);
+        if (StringUtils.isEmpty(from_kj_data)) {
+            return retList;
+        }
+
+        TargetTableVo targetTableVo = new TargetTableVo();
+        targetTableVo.setTargetTableName(from_kj_data);
+        targetTableVo.setRawTableName(v_table.getTableName());
+        targetTableVo.setIsGeography(false);
+        targetTableVo.setSrid(SRID);
+        targetTableVo.setSiweiArea(true);
+
+        List<Map> from_jg = httpAnalyseService.targetTable(targetTableVo);
+        if (from_jg == null || from_jg.size() <= 0) {
+            return retList;
+        }
+        return from_jg;
+    }
+
+    //取并集的函数
+    private List<List<TableDataVo>> queryIntersectionList(String eWkt, String tableId) {
+        List<List<TableDataVo>> retList = new ArrayList<>();
+        // 获取from_table_id
+        QueryWrapper<TableDTO> queryTableTableWrapper = new QueryWrapper<>();
+        queryTableTableWrapper.eq("id", tableId);
+        TableDTO v_table = tableMapper.selectOne(queryTableTableWrapper);
+        if (v_table == null) {
+            return retList;
+        }
+
+        IntersectsTableWktVo intersectsTableWktVo = new IntersectsTableWktVo();
+        intersectsTableWktVo.setEwkt(eWkt);
+        intersectsTableWktVo.setTableName(v_table.getTableName());
+        List<String> from_kj_ids = httpAnalyseService.intersectsTableWkt(intersectsTableWktVo);
+        if (from_kj_ids == null || from_kj_ids.size() == 0) {
+            return retList;
+        }
+        List<TableFiledDTO> list = getFieldListByTableId(tableId, 0);
+        List<String> outputColumn = new ArrayList<>();
+        for (TableFiledDTO v_data : list) {
+            outputColumn.add(v_data.getFiledName());
+        }
+
+        IntersectionTableWktVo intersectionTableWktVo = new IntersectionTableWktVo();
+        intersectionTableWktVo.setEwkt(eWkt);
+        intersectionTableWktVo.setTableIds(from_kj_ids);
+        intersectionTableWktVo.setTableName(v_table.getTableName());
+        String from_kj_data = httpAnalyseService.intersectionTableWkt(intersectionTableWktVo);
+        if (StringUtils.isEmpty(from_kj_data)) {
+            return retList;
+        }
+
+        TargetTableVo targetTableVo = new TargetTableVo();
+        targetTableVo.setTargetTableName(from_kj_data);
+        targetTableVo.setColumns(outputColumn);
+        targetTableVo.setRawTableName(v_table.getTableName());
+        targetTableVo.setIsGeography(false);
+        targetTableVo.setSrid(SRID);
+        targetTableVo.setSiweiArea(true);
+
+        List<Map> from_jg = httpAnalyseService.targetTable(targetTableVo);
+        if (from_jg == null || from_jg.size() <= 0) {
+            return retList;
+        }
+        return dataMapTransFormZh(from_jg, list);
+    }
+
+
     @Override
     public Map dataSelectByPoint(String pointEWkt, String bsm) {
         Map retList = new LinkedHashMap<>();
@@ -319,26 +639,15 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
             }
             Object siweiarea = v_data.get("siweiarea");
             if (StringUtils.isNotNull(siweiarea)) {
-                boolean show = false;
-                for (TableFiledDTO v_filed_data : filedList) {
-                    String v_filedName = v_filed_data.getFiledName();
-                    if (v_filedName.equals("siweiarea")) {
-                        show = true;
-                    }
-                }
-                if (show) {
-                    // 面积
-                    TableDataVo tableDataVo = new TableDataVo();
-                    tableDataVo.setData(new BigDecimal(String.valueOf(siweiarea)).setScale(2, RoundingMode.HALF_UP).doubleValue());
-                    tableDataVo.setFiledZH("面积");
-                    tableDataVo.setFiled("siweiarea");
-                    v_dataList.add(tableDataVo);
-                }
+                // 面积
+                TableDataVo tableDataVo = new TableDataVo();
+                tableDataVo.setData(new BigDecimal(String.valueOf(siweiarea)).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                tableDataVo.setFiledZH("空间面积(平方米)");
+                tableDataVo.setFiled("siweiarea");
+                v_dataList.add(tableDataVo);
             }
             retList.add(v_dataList);
         }
-
-
         return retList;
     }
 
@@ -346,4 +655,19 @@ public class TableDataSelectServiceImpl implements TableDataSelectService {
         List<TableFiledDTO> list = tableFiledMapper.getFiledDTOByTableId(tableId, isDisplay);
         return list;
     }
+
+
+    @Override
+    public List<TableLayerDTO> dataQueryLayer(String defaultType, String layerId) {
+        QueryWrapper<TableLayerDTO> queryTableLayerWrapper = new QueryWrapper<>();
+        if (StringUtils.isNotBlank(defaultType)) {
+            queryTableLayerWrapper.eq("default_type", defaultType);
+        }
+        if (StringUtils.isNotBlank(layerId)) {
+            queryTableLayerWrapper.or(wq -> wq.ne("layer_id", layerId).or().isNull("layer_id"));
+        }
+        queryTableLayerWrapper.eq("pid", "0");
+        queryTableLayerWrapper.orderByAsc("sort");
+        return tableLayerMapper.selectList(queryTableLayerWrapper);
+    }
 }

+ 14 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/table/TableDataSelectService.java

@@ -1,8 +1,22 @@
 package com.onemap.apply.service.table;
 
+import com.onemap.apply.domain.table.TableLayerDTO;
+
+import java.util.List;
 import java.util.Map;
 
 public interface TableDataSelectService {
 
     public Map dataSelectByPoint(String pointEWkt, String bsm);
+
+    /**
+     * @param sourcePointWkt
+     * @param sourceLayerId
+     * @param sourceLayerType 0图层ID 1数据库表id
+     * @param queryTableId
+     * @return
+     */
+    public Map dataQueryByPoint(String sourcePointWkt, String sourceLayerId, String sourceLayerType, String queryTableId);
+
+    public List<TableLayerDTO> dataQueryLayer(String defaultType, String layerId);
 }

+ 19 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/table/TableLayerJgTempMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.onemap.apply.mapper.table.TableLayerJgTempMapper">
+    <insert id="insertTableLayerJgTempList">
+        INSERT INTO t_table_layer_jg_temp (id, groupvalue, sumvalue,geomvalue)
+        VALUES
+        <foreach collection="dtoList" item="item" index="index" separator=",">
+            (#{item.id}, #{item.groupvalue}, #{item.sumvalue},public.st_geomfromewkt(#{item.geomvalue}) )
+        </foreach>
+    </insert>
+
+    <select id="queryTableLayerJgTempList" resultType="map">
+        SELECT groupvalue, sum(sumvalue::numeric) sumvalue, public.st_asewkt(public.st_union(geomvalue)) geomvalue
+        FROM base.t_table_layer_jg_temp x
+        where id = #{id}
+        group by groupvalue
+    </select>
+</mapper>