| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiOperation(value = "æ ¹æ®èå´ç»è®¡") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "WKTææ¬", dataType = "String", paramType = "query", example = "POLYGON ((113.5807 45.4897,113.5898 45.4893,113.5857 45.4837,113.5807 45.4897))"), |
| | | @ApiImplicitParam(name = "z", value = "é«åº¦", dataType = "double", paramType = "query", example = "640"), |
| | | @ApiImplicitParam(name = "deep", value = "深度", dataType = "double", paramType = "query", example = "50") |
| | | @ApiImplicitParam(name = "deep", value = "深度", dataType = "double", paramType = "query", example = "50"), |
| | | @ApiImplicitParam(name = "wkt", value = "WKTææ¬", dataType = "String", paramType = "query", example = "POLYGON ((113.5807 45.4897,113.5898 45.4893,113.5857 45.4837,113.5807 45.4897))") |
| | | }) |
| | | @GetMapping(value = "/countByRange") |
| | | public ResponseMsg<Object> countByRange(String wkt, double z, double deep) { |
| | |
| | | return fail("å¼ææ·±åº¦è¿å°", null); |
| | | } |
| | | |
| | | List<CountEntity> rs = mainService.countByRange("'" + wkt + "'", z, z + deep); |
| | | List<CountEntity> rs = mainService.countByRange(BigDecimal.valueOf(z), BigDecimal.valueOf(z + deep), wkt); |
| | | |
| | | return success("æå", rs); |
| | | return success("æå", null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | return fail(ex.getMessage(), null); |
| | |
| | | package com.terra.coal.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.terra.coal.entity.CountEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ ¹æ®èå´ç»è®¡ |
| | | * |
| | | * @param wkt |
| | | * @param top |
| | | * @param bottom |
| | | * @param wkt |
| | | * @return |
| | | */ |
| | | public List<CountEntity> countByRange(String wkt, double top, double bottom); |
| | | @Select("select ctype, sum(volume) \"volume\", sum(coal_prod) \"coal_prod\", sum(gangue_prod) \"gangue_prod\", 0 \"soil_prod\" from public.coal2000 " + |
| | | "where (top between #{top} and #{bottom} or bottom between #{top} and #{bottom}) and ST_Intersects(geom, ST_PolygonFromText(#{wkt}, 4490))" + |
| | | "group by ctype order by ctype") |
| | | public List<CountEntity> countByRange(@Param("top") BigDecimal top, @Param("bottom") BigDecimal bottom, @Param("wkt") String wkt); |
| | | } |
| | |
| | | Coal54Mapper coal54Mapper; |
| | | |
| | | @Override |
| | | public List<CountEntity> countByRange(String wkt, double top, double bottom) { |
| | | return mainMapper.countByRange(wkt, top, bottom); |
| | | public List<CountEntity> countByRange(BigDecimal top, BigDecimal bottom, String wkt) { |
| | | return mainMapper.countByRange(top, bottom, wkt); |
| | | } |
| | | |
| | | /** |
| | |
| | | <!--æå®å½ç»æéä¸å¼ä¸º null æ¶ï¼æ¯å¦è°ç¨æ å°å¯¹è±¡ç setterï¼map 对象æ¶ä¸º putï¼æ¹æ³--> |
| | | <setting name="callSettersOnNulls" value="true"/> |
| | | <!--æå® MyBatis æç¨æ¥å¿çå
·ä½å®ç°ï¼LOG4J/LOG4J2/SLF4J/STDOUT_LOGGING/NO_LOGGING--> |
| | | <setting name="logImpl" value="NO_LOGGING" /> |
| | | <setting name="logImpl" value="STDOUT_LOGGING" /> |
| | | </settings> |
| | | <typeAliases> |
| | | <package name="com.terra.coal.entity"/> |