根据建筑编号查询近7天近30天噪声和扬尘信息

This commit is contained in:
wuweida 2022-07-01 09:13:19 +08:00
parent 2ca138ffb1
commit 1aaf4edd25
3 changed files with 35 additions and 24 deletions

View File

@ -1,6 +1,7 @@
package com.hisense.monitormanage.controller;
import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.entity.BuildingRecords;
import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.mapper.BuildingRecordsMapper;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -64,7 +66,7 @@ public class BuildingController {
/**
* 查询所有工地
* 查询所有工地最新列表
* @return
*/
@GetMapping("selectAllBuilding")
@ -76,13 +78,25 @@ public class BuildingController {
}
/**
* 查询近7天工地噪声和扬尘的信息
* 根据建筑编号查询近7天工地噪声和扬尘的信息
* @return
*/
@GetMapping("selectWeekPmAndNoice")
@ApiOperation("查询近7天工地噪声和扬尘的信息")
public Result selectWeekPmAndNoice(){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectWeekPmAndNoice();
public Result selectWeekPmAndNoice(String buildLicense){
List<BuildingRecordsDtos> recordsDtos = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense);
Result success = Result.success(recordsDtos);
return success;
}
/**
* 根据建筑编号查询近30天工地噪声和扬尘的信息
* @return
*/
@GetMapping("selectMonthPmAndNoice")
@ApiOperation("查询近30天工地噪声和扬尘的信息")
public Result selectMonthPmAndNoice(String buildLicense){
List<BuildingRecordsDtos> recordsDtos = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense);
Result success = Result.success(recordsDtos);
return success;
}
@ -99,19 +113,6 @@ public class BuildingController {
return success;
}
/**
* 查询近30天工地噪声和扬尘的信息
* @return
*/
@GetMapping("selectMonthPmAndNoice")
@ApiOperation("查询近30天工地噪声和扬尘的信息")
public Result selectMonthPmAndNoice(){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectMonthPmAndNoice();
Result success = Result.success(recordsDtos);
return success;
}
/**
* 根据工地名称搜索工地
* @param projectName

View File

@ -0,0 +1,10 @@
package com.hisense.monitormanage.dto;
import lombok.Data;
@Data
public class BuildingRecordsDtos {
private String pushTime;
private Integer pm10;
private Integer noice;
}

View File

@ -2,6 +2,7 @@ package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.entity.BuildingRecords;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -21,16 +22,15 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
void batchUpdate(@Param("list") List<Map> list);
@Select("SELECT * FROM t_building_new_site bns JOIN t_building_records br ON bns.gdmc = br.project_name")
@Select("select * from (SELECT bns.*,br.project_name,br.push_time,br.pm10,br.noice,br.build_license FROM t_building_records br JOIN t_building_new_site bns " +
"ON br.project_name = bns.gdmc ORDER BY br.push_time DESC LIMIT 93) bs LEFT JOIN t_channel_picture cp ON bs.channel_code = cp.channel_code")
List<BuildingRecordsDto> selectAllBuilding();
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(br.push_time)")
List<BuildingRecordsDto> selectWeekPmAndNoice();
@Select("select DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice from t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(br.push_time) group by pushTime")
List<BuildingRecordsDtos> selectWeekPmAndNoice(String buildLicense);
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) < date(br.push_time)")
List<BuildingRecordsDto> selectMonthPmAndNoice();
@Select("select DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice from t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < date(br.push_time) group by pushTime")
List<BuildingRecordsDtos> selectMonthPmAndNoice(String buildLicense);
List<BuildingRecordsDto> selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize);