From 346500c68778f9b556dbc9419ff8b86ba4458d0a Mon Sep 17 00:00:00 2001 From: "hukekuan@163.com" Date: Tue, 19 Dec 2017 17:26:02 +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/App.java | 16 +++++++ src/main/java/com/gis3c/ol/dao/MapDao.java | 5 +- src/main/java/com/gis3c/ol/entity/Map.java | 48 +++++++++---------- .../java/com/gis3c/ol/service/MapService.java | 4 ++ .../gis3c/ol/service/impl/MapServiceImpl.java | 15 ++++++ .../spatial/postgis/ArrayTypeHandler.java | 8 ++-- src/main/resources/mappings/ol/MapDao.xml | 39 ++++++++++++++- 7 files changed, 105 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/gis3c/App.java b/src/main/java/com/gis3c/App.java index 042c487..60b4706 100644 --- a/src/main/java/com/gis3c/App.java +++ b/src/main/java/com/gis3c/App.java @@ -28,6 +28,22 @@ public class App { MapService mapService = context.getBean(MapService.class); + //地图接口 + Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9"); + System.out.println(map.getLayers()[0][1]); +// Map map = new Map(); +// map.setMapId(UUID.randomUUID().toString()); +// map.setMapName("综合GIS系统"); +// map.setView("ee2f96a0-097a-4f0a-9767-f52b8dae28e0"); +// map.setLogo(false); +// map.setLayers(new String[][]{ +// {"TileLayer","182a8b18-d26f-43da-9b3a-6f90af4825ed"}, +// {"TileLayer","8c396460-9995-4387-8aa1-bb16c2595bba"}, +// {"TileLayer","ad433664-3b2c-4b1b-b271-519b7f647a11"} +// }); +// mapService.insertMap(map); +// +// System.out.println("插入成功"); //图层接口 // TileLayer wmtsLayer = new TileLayer(); diff --git a/src/main/java/com/gis3c/ol/dao/MapDao.java b/src/main/java/com/gis3c/ol/dao/MapDao.java index b879083..f7dec7b 100644 --- a/src/main/java/com/gis3c/ol/dao/MapDao.java +++ b/src/main/java/com/gis3c/ol/dao/MapDao.java @@ -2,7 +2,6 @@ package com.gis3c.ol.dao; import com.gis3c.common.persistence.annotation.C3BatisDao; import com.gis3c.ol.entity.Map; - import java.util.List; /** @@ -11,4 +10,8 @@ import java.util.List; @C3BatisDao public interface MapDao { public List findAllList(); + + public Map findMapById(String mapId); + public Map findMapByName(String mapName); + public Integer insertMap(Map map); } diff --git a/src/main/java/com/gis3c/ol/entity/Map.java b/src/main/java/com/gis3c/ol/entity/Map.java index e79d9cb..201bc7d 100644 --- a/src/main/java/com/gis3c/ol/entity/Map.java +++ b/src/main/java/com/gis3c/ol/entity/Map.java @@ -31,6 +31,22 @@ public class Map { this.mapName = mapName; } + public String getView() { + return view; + } + + public void setView(String view) { + this.view = view; + } + + public String[][] getControls() { + return controls; + } + + public void setControls(String[][] controls) { + this.controls = controls; + } + public Integer getPixelRatio() { return pixelRatio; } @@ -47,14 +63,6 @@ public class Map { this.interactions = interactions; } - public String getView() { - return view; - } - - public void setView(String view) { - this.view = view; - } - public String[][] getLayers() { return layers; } @@ -71,22 +79,6 @@ public class Map { this.logo = logo; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String[][] getControls() { - return controls; - } - - public void setControls(String[][] controls) { - this.controls = controls; - } - public String[][] getOverlays() { return overlays; } @@ -94,4 +86,12 @@ public class Map { public void setOverlays(String[][] overlays) { this.overlays = overlays; } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } } diff --git a/src/main/java/com/gis3c/ol/service/MapService.java b/src/main/java/com/gis3c/ol/service/MapService.java index eedb8d3..c2b1d80 100644 --- a/src/main/java/com/gis3c/ol/service/MapService.java +++ b/src/main/java/com/gis3c/ol/service/MapService.java @@ -9,4 +9,8 @@ import java.util.List; */ public interface MapService { public List findAllList(); + + public Map findMapById(String mapId); + public Map findMapByName(String mapName); + public Integer insertMap(Map map); } diff --git a/src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java b/src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java index 01885be..f45d3cf 100644 --- a/src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java +++ b/src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java @@ -20,4 +20,19 @@ public class MapServiceImpl implements MapService { public List findAllList() { return mapDao.findAllList(); } + + @Override + public Map findMapById(String mapId) { + return mapDao.findMapById(mapId); + } + + @Override + public Map findMapByName(String mapName) { + return mapDao.findMapByName(mapName); + } + + @Override + public Integer insertMap(Map map) { + return mapDao.insertMap(map); + } } diff --git a/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java b/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java index f830495..88e6b8e 100644 --- a/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java +++ b/src/main/java/com/gis3c/spatial/postgis/ArrayTypeHandler.java @@ -21,13 +21,13 @@ public class ArrayTypeHandler extends BaseTypeHandler { @Override public void setNonNullParameter(PreparedStatement ps, int i, Object[] parameter, JdbcType jdbcType) throws SQLException { String typeName = null; - if (parameter instanceof Integer[]) { + if (parameter instanceof Integer[] || parameter instanceof Integer[][]) { typeName = TYPE_NAME_INTEGER; - } else if (parameter instanceof String[]) { + } else if (parameter instanceof String[] || parameter instanceof String[][]) { typeName = TYPE_NAME_VARCHAR; - } else if (parameter instanceof Boolean[]) { + } else if (parameter instanceof Boolean[] || parameter instanceof Boolean[][]) { typeName = TYPE_NAME_BOOLEAN; - } else if (parameter instanceof Double[]) { + } else if (parameter instanceof Double[] || parameter instanceof Boolean[][]) { typeName = TYPE_NAME_NUMERIC; } diff --git a/src/main/resources/mappings/ol/MapDao.xml b/src/main/resources/mappings/ol/MapDao.xml index 750db93..a1d751f 100644 --- a/src/main/resources/mappings/ol/MapDao.xml +++ b/src/main/resources/mappings/ol/MapDao.xml @@ -2,7 +2,7 @@ - + @@ -32,4 +32,41 @@ FROM c3gis_ol_map; + + + + + INSERT INTO c3gis_ol_map( + mapid + , mapname + , view + , controls + , pixelRatio + , interactions + , layers + , logo + , overlays + , description) VALUES ( + #{mapId} + , #{mapName} + , #{view} + , #{controls, javaType=ObjectArray} + , #{pixelRatio} + , #{interactions, javaType=ObjectArray} + , #{layers, javaType=ObjectArray} + , #{logo} + , #{overlays, javaType=ObjectArray} + , #{description} + ); + \ No newline at end of file