From 968f8c4d98cf72e5ca12d450ff80f51b7db86187 Mon Sep 17 00:00:00 2001 From: "hukekuan@163.com" Date: Tue, 6 Feb 2018 18:17:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/gis3c/ol/dao/SourceDao.java | 4 ++- src/main/java/com/gis3c/ol/entity/Layer.java | 9 +++++++ src/main/java/com/gis3c/ol/entity/Source.java | 9 +++++++ .../com/gis3c/ol/service/SourceService.java | 2 +- .../ol/service/impl/LayerServiceImpl.java | 2 -- .../ol/service/impl/SourceServiceImpl.java | 5 ++-- src/main/resources/init.sql | 1 + src/test/java/com/gis3c/spatial/App.java | 26 +++++++++---------- src/test/resources/mappings/ol/LayerDao.xml | 4 +++ src/test/resources/mappings/ol/SourceDao.xml | 9 +++++-- 10 files changed, 49 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/gis3c/ol/dao/SourceDao.java b/src/main/java/com/gis3c/ol/dao/SourceDao.java index 5aa5be1..0eccabf 100644 --- a/src/main/java/com/gis3c/ol/dao/SourceDao.java +++ b/src/main/java/com/gis3c/ol/dao/SourceDao.java @@ -19,7 +19,9 @@ public interface SourceDao { @Param("currentPage") Integer currentPage); public Source findSourceById(String sourceId); public Source findSourceByName(String sourceName); - public List findSourceByType(String[] sourceTypes); + public List findSourceByType( + @Param("sourceTypes") String[] sourceTypes, + @Param("projection") String projection); public Integer insertSource(Source source); public Integer deleteSourcesById(Set sourceIds); diff --git a/src/main/java/com/gis3c/ol/entity/Layer.java b/src/main/java/com/gis3c/ol/entity/Layer.java index 0074a88..996eda1 100644 --- a/src/main/java/com/gis3c/ol/entity/Layer.java +++ b/src/main/java/com/gis3c/ol/entity/Layer.java @@ -18,6 +18,7 @@ public class Layer { private Integer zIndex = 0; private BigDecimal maxResolution; private BigDecimal minResolution; + private String projection; private String type; private java.util.Map options; private String description; @@ -149,4 +150,12 @@ public class Layer { return sourceTypeArray; } + + public String getProjection() { + return projection; + } + + public void setProjection(String projection) { + this.projection = projection; + } } diff --git a/src/main/java/com/gis3c/ol/entity/Source.java b/src/main/java/com/gis3c/ol/entity/Source.java index fc71a2c..5eedd1f 100644 --- a/src/main/java/com/gis3c/ol/entity/Source.java +++ b/src/main/java/com/gis3c/ol/entity/Source.java @@ -10,6 +10,7 @@ public class Source { private String sourceId; private String sourceName; private String type; + private String projection; private java.util.Map options; private String description; @@ -45,6 +46,14 @@ public class Source { this.type = type; } + public String getProjection() { + return projection; + } + + public void setProjection(String projection) { + this.projection = projection; + } + public Map getOptions() { return options; } diff --git a/src/main/java/com/gis3c/ol/service/SourceService.java b/src/main/java/com/gis3c/ol/service/SourceService.java index baae786..6f9c76c 100644 --- a/src/main/java/com/gis3c/ol/service/SourceService.java +++ b/src/main/java/com/gis3c/ol/service/SourceService.java @@ -14,7 +14,7 @@ public interface SourceService { public List> findSourcesByPage(Integer pageSize,Integer currentPage); public Source findSourceById(String sourceId); public Source findSourceByName(String sourceName); - public List findSourceByType(String[] sourceTypes); + public List findSourceByType(String[] sourceTypes,String projection); public Integer insertSource(Source source); diff --git a/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java b/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java index d710d82..3003611 100644 --- a/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java @@ -1,10 +1,8 @@ package com.gis3c.ol.service.impl; - import com.gis3c.common.bean.BeanUtil; import com.gis3c.common.exception.BusinessException; import com.gis3c.ol.dao.LayerDao; import com.gis3c.ol.entity.Layer; -import com.gis3c.ol.entity.Source; import com.gis3c.ol.service.LayerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java b/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java index 59287a1..4316d16 100644 --- a/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java @@ -3,7 +3,6 @@ package com.gis3c.ol.service.impl; import com.gis3c.common.bean.BeanUtil; import com.gis3c.common.exception.BusinessException; import com.gis3c.ol.dao.SourceDao; -import com.gis3c.ol.entity.Map; import com.gis3c.ol.entity.Source; import com.gis3c.ol.service.SourceService; import org.springframework.beans.factory.annotation.Autowired; @@ -49,8 +48,8 @@ public class SourceServiceImpl implements SourceService { } @Override - public List findSourceByType(String[] sourceTypes) { - return sourceDao.findSourceByType(sourceTypes); + public List findSourceByType(String[] sourceTypes,String projection) { + return sourceDao.findSourceByType(sourceTypes,projection); } @Override diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index fb92ffa..07b436a 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -135,6 +135,7 @@ create table c3gis_ol_source( sourceId varchar(50) not null PRIMARY KEY, sourceName varchar(50) not null, type varchar(50) not null, + projection varchar(50) not null, options jsonb, description varchar(50) ); diff --git a/src/test/java/com/gis3c/spatial/App.java b/src/test/java/com/gis3c/spatial/App.java index 08250aa..8b76383 100644 --- a/src/test/java/com/gis3c/spatial/App.java +++ b/src/test/java/com/gis3c/spatial/App.java @@ -29,11 +29,14 @@ public class App { MapService mapService = context.getBean(MapService.class); TestService testService = context.getBean(TestService.class); - Integer result = layerService.bindSource("aabb842e-239e-491d-9c70-a2cec1f65886","d67de989-d351-4ba2-b3ac-021130ae19d4"); - System.out.println(result); +// Integer result = layerService.bindSource("aabb842e-239e-491d-9c70-a2cec1f65886","d67de989-d351-4ba2-b3ac-021130ae19d4"); +// System.out.println(result); -// List sourceList = sourceService.findSourceByType(new String[]{"a","b","c"}); +// Layer queryLayer = layerService.findeLayerById("123"); +// System.out.println(queryLayer); +// List sourceList = sourceService.findSourceByType(new String[]{"ol.source.WMTS"},"EPSG:4326"); +// // System.out.println(sourceList); // sourceList.forEach(u -> System.out.println(u)); @@ -110,16 +113,13 @@ public class App { // System.out.println("插入成功"); //图层接口 -// Layer layer = new Layer(); -// layer.setLayerName("streetmap"); -// layer.setAliasName("超图行政区图"); -// layer.setSource("d7cb5f6f-ee31-4a6e-b8fd-72603a066c2b"); -// layer.setType("ol.layer.Tile"); -// java.util.Map options = new HashMap<>(); -// options.put("projection","EPSG:4326"); -// layer.setOptions(options); -// layerService.insertLayer(layer); -// System.out.println("插入成功"); + Layer layer = new Layer(); + layer.setLayerName("sdkqbigdata"); + layer.setAliasName("大屏行政区"); + layer.setType("ol.layer.Tile"); + layer.setProjection("EPSG:3857"); + layerService.insertLayer(layer); + System.out.println("插入成功"); //资源接口 diff --git a/src/test/resources/mappings/ol/LayerDao.xml b/src/test/resources/mappings/ol/LayerDao.xml index 4378887..9d07673 100644 --- a/src/test/resources/mappings/ol/LayerDao.xml +++ b/src/test/resources/mappings/ol/LayerDao.xml @@ -12,6 +12,7 @@ + @@ -28,6 +29,7 @@ , zIndex , minResolution , maxResolution + , projection , type , options , description @@ -71,6 +73,7 @@ , zIndex , minResolution , maxResolution + , projection , type , options , description @@ -85,6 +88,7 @@ , #{zIndex} , #{maxResolution} , #{minResolution} + , #{projection} , #{type} , #{options, javaType=ObjectJSON}::jsonb , #{description} diff --git a/src/test/resources/mappings/ol/SourceDao.xml b/src/test/resources/mappings/ol/SourceDao.xml index 239e166..a987264 100644 --- a/src/test/resources/mappings/ol/SourceDao.xml +++ b/src/test/resources/mappings/ol/SourceDao.xml @@ -5,6 +5,7 @@ + @@ -13,6 +14,7 @@ sourceId , sourceName , type + , projection , options , description @@ -47,22 +49,25 @@ FROM c3gis_ol_source WHERE type in - + #{item, javaType=java.lang.String} - ORDER BY type; + and projection = #{projection, javaType=java.lang.String} + ORDER BY sourceName; INSERT INTO c3gis_ol_source(sourceId , sourceName , type + , projection , options , description ) VALUES(#{sourceId} , #{sourceName} , #{type} + , #{projection} , #{options, javaType=ObjectJSON}::jsonb , #{description} );