添加道路污染累计事件接口

This commit is contained in:
wuweida 2022-06-13 17:53:24 +08:00
parent cfc3023d04
commit c8575c1dab
5 changed files with 34 additions and 23 deletions

View File

@ -571,19 +571,13 @@ public class Controller {
} }
/** /**
* 分页查询全部道路污染数据 * 查询全部道路污染累计事件数量
* @param page
* @param pageSize
* @return * @return
*/ */
@GetMapping("selectRoadData") @GetMapping("selectRoadData")
@ApiOperation("分页查询全部道路污染数据") @ApiOperation("查询全部道路污染累计事件数量")
@ApiImplicitParams({ public Result selectRoadData(){
@ApiImplicitParam(name = "page", value = "页码", paramType = "query", dataType = "Integer", required = true), List<RoadData> roadData = roadDataService.selectRoadData();
@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); Result success = Result.success(roadData);
return success; return success;
} }

View File

@ -17,5 +17,5 @@ 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); /*List<RoadData> selectRoadData(@Param("page") Integer page, @Param("pageSize") Integer pageSize);*/
} }

View File

@ -227,7 +227,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -269,7 +270,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -311,7 +313,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -353,7 +356,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -395,7 +399,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -437,7 +442,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -479,7 +485,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -521,7 +528,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -562,7 +570,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
@ -604,7 +613,8 @@ public class MonitorService {
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ ChannelPicture id = channelPictureMapper.selectById(channelCode);
if (id == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();

View File

@ -90,6 +90,13 @@ public class RoadDataService {
return list; return list;
} }
public List<RoadData> selectRoadData(){
QueryWrapper<RoadData> queryWrapper = new QueryWrapper<>();
queryWrapper.gt("pm10",200);
List<RoadData> list = roadDataMapper.selectList(queryWrapper);
return list;
}
//获取当前日期的时间串2022-05-08 00:00:00 //获取当前日期的时间串2022-05-08 00:00:00
private String dateTimeStr(){ private String dateTimeStr(){
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();

View File

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