初始化

This commit is contained in:
hukekuan@163.com 2017-12-15 18:30:44 +08:00
parent ab86b3058c
commit b5861722b4
12 changed files with 173 additions and 25 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -32,7 +32,7 @@ public class ArrayTypeHandler extends BaseTypeHandler<Object[]> {
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);
}

View File

@ -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)
);

View File

@ -0,0 +1,85 @@
<?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.gis3c.ol.dao.ViewDao">
<resultMap id="viewResult" type="com.gis3c.ol.entity.View">
<result property="viewId" column="viewid"/>
<result property="viewName" column="viewname" />
<result property="center" column="center" javaType="Object"/>
<result property="extent" column="extent" javaType="Object"/>
<result property="maxResolution" column="maxresolution" />
<result property="minResolution" column="minresolution" />
<result property="maxZoom" column="maxzoom" />
<result property="minZoom" column="minzoom" />
<result property="zoom" column="zoom" />
<result property="projection" column="projection" />
<result property="resolution" column="resolution" />
<result property="resolutions" column="resolutions" javaType="Object"/>
<result property="rotation" column="rotation" />
<result property="description" column="description" />
</resultMap>
<sql id="viewColumns">
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
</sql>
<select id="findeViewById" resultMap="viewResult">
SELECT
<include refid="viewColumns"/>
FROM c3gis_ol_view v
WHERE v.viewid = #{viewId};
</select>
<select id="findeViewByName" resultMap="viewResult">
SELECT
<include refid="viewColumns"/>
FROM c3gis_ol_view v
WHERE v.viewname = #{viewName};
</select>
<insert id="insertView" parameterType="com.gis3c.ol.entity.View">
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});
</insert>
</mapper>

View File

@ -2,8 +2,39 @@
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<settings>
<!-- 使全局的映射器启用或禁用缓存。 -->
<setting name="cacheEnabled" value="true"/>
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 -->
<setting name="lazyLoadingEnabled" value="true"/>
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。 -->
<setting name="aggressiveLazyLoading" value="true"/>
<!-- 是否允许单条sql 返回多个数据集 (取决于驱动的兼容性) default:true -->
<setting name="multipleResultSetsEnabled" value="true"/>
<!-- 是否可以使用列的别名 (取决于驱动的兼容性) default:true -->
<setting name="useColumnLabel" value="true"/>
<!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true这个设置将强制使用被生成的主键有一些驱动器不兼容不过仍然可以执行。 default:false -->
<setting name="useGeneratedKeys" value="false"/>
<!-- 指定 MyBatis 如何自动映射 数据基表的列 NONE不隐射 PARTIAL:部分 FULL:全部 -->
<setting name="autoMappingBehavior" value="PARTIAL"/>
<!-- 这是默认的执行类型 SIMPLE: 简单; REUSE: 执行器可能重复使用prepared statements语句BATCH: 执行器可以重复执行语句和批量更新) -->
<setting name="defaultExecutorType" value="SIMPLE"/>
<!-- 使用驼峰命名法转换字段。 -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- 设置本地缓存范围 session:就会有数据的共享 statement:语句范围 (这样就不会有数据的共享 ) defalut:session -->
<setting name="localCacheScope" value="SESSION"/>
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER插入空值时不需要指定类型 -->
<setting name="jdbcTypeForNull" value="NULL"/>
</settings>
<!--