Commit cd67ab98 by Jbb

图层代码 完结

parent 9eda25cd
package com.founder.commonutils.viewEntity; package com.founder.commonutils.viewEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -13,10 +13,11 @@ import java.util.Date; ...@@ -13,10 +13,11 @@ import java.util.Date;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tb_st_layer_data") @TableName("tb_st_layer_data")
@ApiModel(value="图层数据对象", description="图层数据") @ApiModel(value="图层数据对象", description="图层数据")
public class TbStLayerData implements Serializable { public class TbStLayerData extends PageInfo implements Serializable {
@TableId(value = "xxzjbh") @TableId(value = "xxzjbh")
private String xxzjbh; private String xxzjbh;
private String gl_xxzjbh; //@TableField(value = "gl_xxzjbh")
private String glXxzjbh;
private double x; //经度 private double x; //经度
private double y; //纬度 private double y; //纬度
private String xStr; //保存错误的经度 private String xStr; //保存错误的经度
...@@ -32,12 +33,12 @@ public class TbStLayerData implements Serializable { ...@@ -32,12 +33,12 @@ public class TbStLayerData implements Serializable {
this.xxzjbh = xxzjbh; this.xxzjbh = xxzjbh;
} }
public String getGl_xxzjbh() { public String getGlXxzjbh() {
return gl_xxzjbh; return glXxzjbh;
} }
public void setGl_xxzjbh(String gl_xxzjbh) { public void setGlXxzjbh(String glXxzjbh) {
this.gl_xxzjbh = gl_xxzjbh; this.glXxzjbh = glXxzjbh;
} }
public double getX() { public double getX() {
......
...@@ -3,10 +3,13 @@ package com.founder.view.config; ...@@ -3,10 +3,13 @@ package com.founder.view.config;
import com.baomidou.mybatisplus.core.injector.ISqlInjector; import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector; import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.github.pagehelper.PageHelper;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Properties;
@Configuration @Configuration
@MapperScan("com.founder.view.mapper") @MapperScan("com.founder.view.mapper")
public class EduConfig { public class EduConfig {
...@@ -27,5 +30,15 @@ public class EduConfig { ...@@ -27,5 +30,15 @@ public class EduConfig {
return new PaginationInterceptor(); return new PaginationInterceptor();
} }
@Bean
public PageHelper getPageHelper(){
PageHelper pageHelper=new PageHelper();
Properties properties=new Properties();
properties.setProperty("helperDialect","mysql");
properties.setProperty("reasonable","true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","count=countSql");
pageHelper.setProperties(properties);
return pageHelper;
}
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.publicEntity.MapRestResult; import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayer; import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.view.service.TbStLayerDataService;
import com.founder.view.service.TbStLayerService; import com.founder.view.service.TbStLayerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -19,10 +20,19 @@ import javax.annotation.Resource; ...@@ -19,10 +20,19 @@ import javax.annotation.Resource;
public class TbStLayerController { public class TbStLayerController {
@Resource @Resource
TbStLayerService tbStLayerService; TbStLayerService tbStLayerService;
@Resource
TbStLayerDataService tbStLayerDataService;
@RequestMapping("/getLayers") @RequestMapping("/getLayers")
public MapRestResult getLayers(@RequestBody TbStLayer tbStLayer) { public MapRestResult getLayers(@RequestBody TbStLayer tbStLayer) {
return tbStLayerService.getLayers(tbStLayer,tbStLayer.getPageNo(),tbStLayer.getSize()); return tbStLayerService.getLayers(tbStLayer,tbStLayer.getPageNo(),tbStLayer.getSize());
} }
@RequestMapping("/getLayerData")
public MapRestResult getLayerData(@RequestBody TbStLayer tbStLayer) {
return tbStLayerDataService.selectByGlId(tbStLayer.getXxzjbh(),tbStLayer.getPageNo(),tbStLayer.getSize());
}
} }
...@@ -2,6 +2,7 @@ package com.founder.view.mapper; ...@@ -2,6 +2,7 @@ package com.founder.view.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayerData; import com.founder.commonutils.viewEntity.TbStLayerData;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -22,4 +23,5 @@ public interface TbStLayerDataMapper extends BaseMapper<TbStLayerData> { ...@@ -22,4 +23,5 @@ public interface TbStLayerDataMapper extends BaseMapper<TbStLayerData> {
void deleteByGlId(String layerId); void deleteByGlId(String layerId);
List<TbStLayerData> selectByGlId(String layerId); List<TbStLayerData> selectByGlId(String layerId);
} }
package com.founder.view.service; package com.founder.view.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayerData; import com.founder.commonutils.viewEntity.TbStLayerData;
public interface TbStLayerDataService extends IService<TbStLayerData> { public interface TbStLayerDataService extends IService<TbStLayerData> {
void deleteByGlId(String layerId); void deleteByGlId(String layerId);
MapRestResult selectByGlId(String layerId,Integer pageNo, Integer size);
} }
package com.founder.view.service.impl; package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.commonutils.viewEntity.TbStLayerData; import com.founder.commonutils.viewEntity.TbStLayerData;
import com.founder.view.mapper.TbStLayerDataMapper; import com.founder.view.mapper.TbStLayerDataMapper;
import com.founder.view.service.TbStLayerDataService; import com.founder.view.service.TbStLayerDataService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service @Service
public class TbStLayerDataServiceImpl extends ServiceImpl<TbStLayerDataMapper, TbStLayerData> implements TbStLayerDataService { public class TbStLayerDataServiceImpl extends ServiceImpl<TbStLayerDataMapper, TbStLayerData> implements TbStLayerDataService {
...@@ -17,4 +23,25 @@ public class TbStLayerDataServiceImpl extends ServiceImpl<TbStLayerDataMapper, T ...@@ -17,4 +23,25 @@ public class TbStLayerDataServiceImpl extends ServiceImpl<TbStLayerDataMapper, T
public void deleteByGlId(String layerId) { public void deleteByGlId(String layerId) {
tbStLayerDataMapper.deleteByGlId(layerId); tbStLayerDataMapper.deleteByGlId(layerId);
} }
@Override
public MapRestResult selectByGlId(String layerId,Integer pageNo, Integer size) {
try {
if(pageNo != null && pageNo != 0 && size != null && size != 0) {
PageHelper.startPage(pageNo, size);
List<TbStLayerData> tbStLayerDatas = tbStLayerDataMapper.selectByGlId(layerId);
PageInfo<TbStLayerData> pageInfo = new PageInfo<>(tbStLayerDatas);
return MapRestResult.build(200,"图层数据查询成功!",pageInfo.getTotal(),pageInfo);
}else{
List<TbStLayerData> tbStLayerDatas = tbStLayerDataMapper.selectByGlId(layerId);
return MapRestResult.build(200,"图层数据查询成功!",null,tbStLayerDatas);
}
} catch (Exception e) {
e.printStackTrace();
return MapRestResult.build(500,"图层数据查询失败!",null,null);
}
}
} }
...@@ -26,21 +26,32 @@ public class TbStLayerServiceImpl extends ServiceImpl<TbStLayerMapper, TbStLayer ...@@ -26,21 +26,32 @@ public class TbStLayerServiceImpl extends ServiceImpl<TbStLayerMapper, TbStLayer
@Override @Override
public MapRestResult<TbStLayer> getLayers(TbStLayer tbStLayer, Integer pageNo, Integer size) { public MapRestResult<TbStLayer> getLayers(TbStLayer tbStLayer, Integer pageNo, Integer size) {
try { try {
pageNo = 1; if(pageNo != null && pageNo != 0 && size != null && size != 0) {
size= 10; PageHelper.startPage(pageNo, size);
PageHelper.startPage(pageNo,size); List<TbStLayer> tbStLayerList = new ArrayList<>();
List<TbStLayer> tbStLayerList = new ArrayList<>(); List<TbStLayer> tbStLayers = tbStLayerMapper.selectLayers(tbStLayer);
List<TbStLayer> tbStLayers = tbStLayerMapper.selectLayers(tbStLayer); if (tbStLayers != null && tbStLayers.size() > 0) {
if(tbStLayers != null && tbStLayers.size() > 0){ for (TbStLayer stLayer : tbStLayers) {
for (TbStLayer stLayer : tbStLayers) { List<TbStLayerData> tbStLayerDataList = tbStLayerDataMapper.selectByGlId(stLayer.getXxzjbh());
List<TbStLayerData> tbStLayerDataList = tbStLayerDataMapper.selectByGlId(stLayer.getXxzjbh()); stLayer.setCount(tbStLayerDataList.size());
stLayer.setCount(tbStLayerDataList.size()); tbStLayerList.add(stLayer);
tbStLayerList.add(stLayer); }
} }
}
PageInfo<TbStLayer> pageInfo = new PageInfo<>(tbStLayerList); PageInfo<TbStLayer> pageInfo = new PageInfo<>(tbStLayerList);
return MapRestResult.build(200,"图层信息查询成功!",pageInfo.getTotal(),pageInfo); return MapRestResult.build(200, "图层信息查询成功!", pageInfo.getTotal(), pageInfo);
}else{
List<TbStLayer> tbStLayerList = new ArrayList<>();
List<TbStLayer> tbStLayers = tbStLayerMapper.selectLayers(tbStLayer);
if (tbStLayers != null && tbStLayers.size() > 0) {
for (TbStLayer stLayer : tbStLayers) {
List<TbStLayerData> tbStLayerDataList = tbStLayerDataMapper.selectByGlId(stLayer.getXxzjbh());
stLayer.setCount(tbStLayerDataList.size());
tbStLayerList.add(stLayer);
}
}
return MapRestResult.build(200, "图层信息查询成功!", null, tbStLayerList);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return MapRestResult.build(500,"图层信息查询失败!",null,null); return MapRestResult.build(500,"图层信息查询失败!",null,null);
......
...@@ -5,7 +5,7 @@ spring.cloud.nacos.discovery.server-addr=47.92.48.137:9949 ...@@ -5,7 +5,7 @@ spring.cloud.nacos.discovery.server-addr=47.92.48.137:9949
#spring.cloud.nacos.config.server-addr=26.3.13.184:8848 #spring.cloud.nacos.config.server-addr=26.3.13.184:8848
#spring.cloud.nacos.discovery.server-addr=26.3.13.184:8848 #spring.cloud.nacos.discovery.server-addr=26.3.13.184:8848
spring.profiles.active=dev #spring.profiles.active=dev
# 该配置影响统一配置中心中的dataId # 该配置影响统一配置中心中的dataId
spring.application.name=view spring.application.name=view
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment