diff --git a/src/main/java/com/gis3c/App.java b/src/main/java/com/gis3c/App.java index d2bdac2..6c2170d 100644 --- a/src/main/java/com/gis3c/App.java +++ b/src/main/java/com/gis3c/App.java @@ -1,10 +1,14 @@ package com.gis3c; +import com.gis3c.ol.entity.View; import com.gis3c.ol.service.MapService; +import com.gis3c.ol.service.ViewService; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.gis3c.ol.entity.Map; +import java.util.UUID; + /** * Created by hukekuan on 2017/12/14. */ @@ -14,9 +18,25 @@ public class App { } public static void main(String[] args) { ApplicationContext context = ApplicationInit(); - MapService mapService = context.getBean(MapService.class); - Map map = mapService.findAllList().get(0); - String[][] controls = map.getControls(); - System.out.println(controls); + ViewService viewService = context.getBean(ViewService.class); + View view = new View(); + String id = UUID.randomUUID().toString(); + + view.setViewId(id); + System.out.println(view.getViewId()); + view.setViewName("测试视图"); + view.setCenter(new Double[]{117.089151, 36.738693}); + view.setProjection("EPSG:4326"); + view.setMinZoom(8); + view.setMaxZoom(18); + view.setZoom(9); + + viewService.insertView(view); + System.out.println("插入成功"); + +// MapService mapService = context.getBean(MapService.class); +// Map map = mapService.findAllList().get(0); +// String[][] controls = map.getControls(); +// System.out.println(controls); } } diff --git a/src/main/java/com/gis3c/ol/dao/LayerDao.java b/src/main/java/com/gis3c/ol/dao/LayerDao.java index 82bce60..ccb1675 100644 --- a/src/main/java/com/gis3c/ol/dao/LayerDao.java +++ b/src/main/java/com/gis3c/ol/dao/LayerDao.java @@ -1,11 +1,13 @@ package com.gis3c.ol.dao; +import com.gis3c.common.persistence.annotation.C3BatisDao; import com.gis3c.ol.entity.layer.TileLayer; import com.gis3c.ol.entity.layer.VectorLayer; /** * Created by hukekuan on 2017/12/15. */ +@C3BatisDao public interface LayerDao { public TileLayer findeTileLayerById(String layerId); public TileLayer findeTileLayerByName(String layerName); diff --git a/src/main/java/com/gis3c/ol/dao/SourceDao.java b/src/main/java/com/gis3c/ol/dao/SourceDao.java index 2d86b93..6e5e5d4 100644 --- a/src/main/java/com/gis3c/ol/dao/SourceDao.java +++ b/src/main/java/com/gis3c/ol/dao/SourceDao.java @@ -1,5 +1,6 @@ package com.gis3c.ol.dao; +import com.gis3c.common.persistence.annotation.C3BatisDao; import com.gis3c.ol.entity.source.TileArcGISRest; import com.gis3c.ol.entity.source.TileSuperMapRest; import com.gis3c.ol.entity.source.Vector; @@ -8,6 +9,7 @@ import com.gis3c.ol.entity.source.Wmts; /** * Created by hukekuan on 2017/12/15. */ +@C3BatisDao public interface SourceDao { public TileArcGISRest findTileArcGISRestById(String sourceId); public TileArcGISRest findTileArcGISRestByName(String sourceName); diff --git a/src/main/java/com/gis3c/ol/dao/ViewDao.java b/src/main/java/com/gis3c/ol/dao/ViewDao.java index de8fad3..b26f334 100644 --- a/src/main/java/com/gis3c/ol/dao/ViewDao.java +++ b/src/main/java/com/gis3c/ol/dao/ViewDao.java @@ -1,10 +1,12 @@ package com.gis3c.ol.dao; +import com.gis3c.common.persistence.annotation.C3BatisDao; import com.gis3c.ol.entity.View; /** * Created by hukekuan on 2017/12/15. */ +@C3BatisDao public interface ViewDao { public View findeViewById(String viewId); public View findeViewByName(String viewName); diff --git a/src/main/java/com/gis3c/ol/entity/View.java b/src/main/java/com/gis3c/ol/entity/View.java index 76524c9..d86bb99 100644 --- a/src/main/java/com/gis3c/ol/entity/View.java +++ b/src/main/java/com/gis3c/ol/entity/View.java @@ -8,14 +8,14 @@ public class View { private String viewName; private Double[] center; private Double[] extent; - private Double maxResolution; - private Double minResolution; + private String maxResolution; + private String minResolution; private Integer maxZoom; private Integer minZoom; private Integer zoom; private String projection; - private Double resolution; - private Double resolutions; + private String resolution; + private String[] resolutions; private Double rotation; private String description; @@ -51,19 +51,19 @@ public class View { this.extent = extent; } - public Double getMaxResolution() { + public String getMaxResolution() { return maxResolution; } - public void setMaxResolution(Double maxResolution) { + public void setMaxResolution(String maxResolution) { this.maxResolution = maxResolution; } - public Double getMinResolution() { + public String getMinResolution() { return minResolution; } - public void setMinResolution(Double minResolution) { + public void setMinResolution(String minResolution) { this.minResolution = minResolution; } @@ -99,19 +99,19 @@ public class View { this.projection = projection; } - public Double getResolution() { + public String getResolution() { return resolution; } - public void setResolution(Double resolution) { + public void setResolution(String resolution) { this.resolution = resolution; } - public Double getResolutions() { + public String[] getResolutions() { return resolutions; } - public void setResolutions(Double resolutions) { + public void setResolutions(String[] resolutions) { this.resolutions = resolutions; } 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 ab62aec..ca74479 100644 --- a/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/LayerServiceImpl.java @@ -5,10 +5,12 @@ import com.gis3c.ol.entity.layer.TileLayer; import com.gis3c.ol.entity.layer.VectorLayer; import com.gis3c.ol.service.LayerService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Created by hukekuan on 2017/12/15. */ +@Service public class LayerServiceImpl implements LayerService { @Autowired private LayerDao layerDao; 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 ce59c8f..59498e1 100644 --- a/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/SourceServiceImpl.java @@ -7,10 +7,12 @@ import com.gis3c.ol.entity.source.Vector; import com.gis3c.ol.entity.source.Wmts; import com.gis3c.ol.service.SourceService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Created by hukekuan on 2017/12/15. */ +@Service public class SourceServiceImpl implements SourceService { @Autowired private SourceDao sourceDao; diff --git a/src/main/java/com/gis3c/ol/service/impl/ViewServiceImpl.java b/src/main/java/com/gis3c/ol/service/impl/ViewServiceImpl.java index 49e245e..5af1be0 100644 --- a/src/main/java/com/gis3c/ol/service/impl/ViewServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/ViewServiceImpl.java @@ -4,10 +4,12 @@ import com.gis3c.ol.dao.ViewDao; import com.gis3c.ol.entity.View; import com.gis3c.ol.service.ViewService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Created by hukekuan on 2017/12/14. */ +@Service public class ViewServiceImpl implements ViewService { @Autowired private ViewDao viewDao; diff --git a/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java b/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java index ed8819c..ef8e3d8 100644 --- a/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java +++ b/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java @@ -32,7 +32,7 @@ public class ArrayTypeHandler extends BaseTypeHandler { if (typeName == null) { throw new TypeException("ArrayTypeHandler parameter typeName error, your type is " + parameter.getClass().getName()); } - + System.out.println("======= "+ typeName +" ======="); Array array = ps.getConnection().createArrayOf(typeName, parameter); ps.setArray(i, array); } diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index 13779cf..b8c5eb9 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -16,17 +16,17 @@ create table c3gis_ol_map( create table c3gis_ol_view( viewid varchar(50) not null PRIMARY KEY, viewname varchar(50) not null, - center decimal ARRAY[2], - extent decimal ARRAY[4], - maxresolution decimal, - minresolution decimal, + center NUMERIC(14,6) ARRAY[2], + extent NUMERIC(14,6) ARRAY[4], + maxresolution varchar(50), + minresolution varchar(50), maxzoom int, minzoom int, zoom int, projection varchar(50), - resolution decimal, - resolutions decimal ARRAY, - rotation decimal, + resolution varchar(50), + resolutions varchar(50) ARRAY, + rotation NUMERIC(7,4), description varchar(50) ); diff --git a/src/main/resources/mappings/ol/ViewDao.xml b/src/main/resources/mappings/ol/ViewDao.xml new file mode 100644 index 0000000..70ee113 --- /dev/null +++ b/src/main/resources/mappings/ol/ViewDao.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + v.viewid + , v.viewname + , v.center + , v.extent + , v.maxresolution + , v.minresolution + , v.maxzoom + , v.minzoom + , v.zoom + , v.projection + , v.resolution + , v.resolutions + , v.rotation + , v.description + + + + + + + + INSERT INTO c3gis_ol_view( + viewid + , viewname + , center + , extent + , maxresolution + , minresolution + , maxzoom + , minzoom + , zoom + , projection + , resolution + , resolutions + , rotation + , description + ) + VALUES( + #{viewId} + , #{viewName} + , #{center} + , #{extent} + , #{maxResolution} + , #{minResolution} + , #{maxZoom} + , #{minZoom} + , #{zoom} + , #{projection} + , #{resolution} + , #{resolutions} + , #{rotation} + , #{description}); + + \ No newline at end of file diff --git a/src/main/resources/sql-map-config-mybatis.xml b/src/main/resources/sql-map-config-mybatis.xml index 5438712..76bc41f 100644 --- a/src/main/resources/sql-map-config-mybatis.xml +++ b/src/main/resources/sql-map-config-mybatis.xml @@ -2,8 +2,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +