添加分页查询全部道路污染数据接口

This commit is contained in:
wuweida 2022-06-13 16:36:49 +08:00
parent f91c9e3205
commit cfc3023d04
4 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package com.hisense.monitormanage.controller; package com.hisense.monitormanage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hisense.monitormanage.dto.*; import com.hisense.monitormanage.dto.*;
import com.hisense.monitormanage.entity.*; import com.hisense.monitormanage.entity.*;
import com.hisense.monitormanage.mapper.*; import com.hisense.monitormanage.mapper.*;
@ -71,6 +72,9 @@ public class Controller {
@Autowired @Autowired
private TrailSanitationMapper trailSanitationMapper; private TrailSanitationMapper trailSanitationMapper;
@Autowired
private RoadDataMapper roadDataMapper;
@GetMapping("all") @GetMapping("all")
public Object all(){ public Object all(){
@ -566,6 +570,24 @@ public class Controller {
return Result.success(list); return Result.success(list);
} }
/**
* 分页查询全部道路污染数据
* @param page
* @param pageSize
* @return
*/
@GetMapping("selectRoadData")
@ApiOperation("分页查询全部道路污染数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", paramType = "query", dataType = "Integer", required = true),
@ApiImplicitParam(name = "pageSize", value = "大小", paramType = "query", dataType = "Integer", required = true)
})
public Result selectRoadData(Integer page,Integer pageSize){
List<RoadData> roadData = roadDataMapper.selectRoadData(page,pageSize);
Result success = Result.success(roadData);
return success;
}
//查询工地信息根据经纬度和半径查询 //查询工地信息根据经纬度和半径查询
@GetMapping(value = "listBuildingSiteByPoints") @GetMapping(value = "listBuildingSiteByPoints")

View File

@ -2,6 +2,7 @@ package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.entity.RoadData; import com.hisense.monitormanage.entity.RoadData;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -15,4 +16,6 @@ import java.util.Map;
*/ */
public interface RoadDataMapper extends BaseMapper<RoadData> { public interface RoadDataMapper extends BaseMapper<RoadData> {
public void batchSave(List<Map> list); public void batchSave(List<Map> list);
List<RoadData> selectRoadData(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
} }

View File

@ -36,16 +36,16 @@ public class LongLatUtil {
/** /**
* 根据经纬度和半径计算经纬度范围 * 根据经纬度和半径计算经纬度范围
* *
* @param raidus 单位米 * @param radius 单位米
* @return minLat, minLng, maxLat, maxLng * @return minLat, minLng, maxLat, maxLng
*/ */
public static double[] getAround(double lon,double lat, int raidus) { public static double[] getAround(double lon,double lat, int radius) {
Double latitude = lat; Double latitude = lat;
Double longitude = lon; Double longitude = lon;
Double degree = (24901 * 1609) / 360.0; Double degree = (24901 * 1609) / 360.0;
double raidusMile = raidus; double raidusMile = radius;
Double dpmLat = 1 / degree; Double dpmLat = 1 / degree;
Double radiusLat = dpmLat * raidusMile; Double radiusLat = dpmLat * raidusMile;

View File

@ -16,4 +16,10 @@
</foreach> </foreach>
</insert> </insert>
<select id="selectRoadData" resultType="com.hisense.monitormanage.entity.RoadData">
select * from t_road_data
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</select>
</mapper> </mapper>