初始化
This commit is contained in:
parent
79ea3f0c58
commit
ddbb4a123c
@ -19,6 +19,7 @@ public interface LayerDao {
|
|||||||
|
|
||||||
public Layer findeLayerById(String layerId);
|
public Layer findeLayerById(String layerId);
|
||||||
public Layer findeLayerByName(String layerName);
|
public Layer findeLayerByName(String layerName);
|
||||||
|
public List<Layer> findLayerByIds(String[] layerIds);
|
||||||
|
|
||||||
public Integer insertLayer(Layer layer);
|
public Integer insertLayer(Layer layer);
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public interface LayerService {
|
|||||||
|
|
||||||
public Layer findeLayerById(String layerId);
|
public Layer findeLayerById(String layerId);
|
||||||
public Layer findeLayerByName(String layerName);
|
public Layer findeLayerByName(String layerName);
|
||||||
|
public List<LayerSource> findLayerByIds(String[] layerIds);
|
||||||
|
|
||||||
public Integer insertLayer(Layer layer);
|
public Integer insertLayer(Layer layer);
|
||||||
public Integer bindSource(String layerId,String sourceId,java.util.Map<String,Object> options);
|
public Integer bindSource(String layerId,String sourceId,java.util.Map<String,Object> options);
|
||||||
|
|||||||
@ -96,6 +96,34 @@ public class LayerServiceImpl implements LayerService {
|
|||||||
return layerDao.findeLayerByName(layerName);
|
return layerDao.findeLayerByName(layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LayerSource> findLayerByIds(String[] layerIds) {
|
||||||
|
List<LayerSource> result = new ArrayList<>();
|
||||||
|
if(layerIds != null){
|
||||||
|
List<Layer> layerList = layerDao.findLayerByIds(layerIds);
|
||||||
|
Layer queryLayer;
|
||||||
|
LayerSource layerSource;
|
||||||
|
String sourceId;
|
||||||
|
for(String layerId : layerIds){
|
||||||
|
queryLayer = layerList
|
||||||
|
.stream()
|
||||||
|
.filter(layer -> layer.getLayerId().equals(layerId))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if(queryLayer != null){
|
||||||
|
layerSource = new LayerSource();
|
||||||
|
layerSource.setLayer(queryLayer);
|
||||||
|
sourceId = queryLayer.getSource();
|
||||||
|
layerSource.setSource(sourceDao.findSourceById(sourceId));
|
||||||
|
|
||||||
|
result.add(layerSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer insertLayer(Layer layer) {
|
public Integer insertLayer(Layer layer) {
|
||||||
layer.setLayerId(UUID.randomUUID().toString());
|
layer.setLayerId(UUID.randomUUID().toString());
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by hukekuan on 2017/12/14.
|
* Created by hukekuan on 2017/12/14.
|
||||||
@ -28,15 +30,19 @@ public class App {
|
|||||||
MapService mapService = context.getBean(MapService.class);
|
MapService mapService = context.getBean(MapService.class);
|
||||||
TestService testService = context.getBean(TestService.class);
|
TestService testService = context.getBean(TestService.class);
|
||||||
|
|
||||||
|
List<LayerSource> layerSources
|
||||||
|
= layerService.findLayerByIds(new String[]{"aabb842e-239e-491d-9c70-a2cec1f65886"});
|
||||||
|
|
||||||
List<String> layerIdList = new ArrayList<>(Arrays.asList(new String[]{
|
System.out.println(layerSources);
|
||||||
"a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
|
||||||
"aabb842e-239e-491d-9c70-a2cec1f65886"
|
// List<String> layerIdList = new ArrayList<>(Arrays.asList(new String[]{
|
||||||
}));
|
// "a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
||||||
List<MapLayer> result = layerService.findSimpleLayerList(layerIdList);
|
// "aabb842e-239e-491d-9c70-a2cec1f65886"
|
||||||
System.out.println(result.size());
|
// }));
|
||||||
System.out.println(result.get(0).getLayer().getLayerId());
|
// List<MapLayer> result = layerService.findSimpleLayerList(layerIdList);
|
||||||
System.out.println(result.get(1).getLayer().getLayerId());
|
// System.out.println(result.size());
|
||||||
|
// System.out.println(result.get(0).getLayer().getLayerId());
|
||||||
|
// System.out.println(result.get(1).getLayer().getLayerId());
|
||||||
|
|
||||||
|
|
||||||
// String result = testList.stream().filter(test-> "2".equals(test)).findFirst().orElse(null);
|
// String result = testList.stream().filter(test-> "2".equals(test)).findFirst().orElse(null);
|
||||||
|
|||||||
@ -55,6 +55,17 @@
|
|||||||
WHERE layerId = #{layerId, javaType=java.lang.String};
|
WHERE layerId = #{layerId, javaType=java.lang.String};
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findLayerByIds" resultMap="layerResult">
|
||||||
|
SELECT
|
||||||
|
<include refid="layerColumns"/>
|
||||||
|
FROM c3gis_ol_layer
|
||||||
|
WHERE layerId IN
|
||||||
|
<foreach collection ="array" item="item" index="index" open="(" separator="," close=")">
|
||||||
|
#{item, javaType=java.lang.String}
|
||||||
|
</foreach>
|
||||||
|
;
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="findeLayerByName" resultMap="layerResult">
|
<select id="findeLayerByName" resultMap="layerResult">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="layerColumns"/>
|
<include refid="layerColumns"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user