| | |
| | | package com.sandu.ximon.dao.bo; |
| | | |
| | | import com.sandu.ximon.dao.domain.AirDataNongGeng; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | | * @date 2022/4/25 15:10 |
| | | */ |
| | | @Data |
| | | public class AirDataNongGengBo extends AirDataNongGeng { |
| | | private String poleId; |
| | | private String PoleName; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 农耕大气监测数据 |
| | | * |
| | | * @TableName air_data_nong_geng |
| | | */ |
| | | @TableName(value ="air_data_nong_geng") |
| | | @TableName(value = "air_data_nong_geng") |
| | | @Data |
| | | public class AirDataNongGeng implements Serializable { |
| | | /** |
| | |
| | | /** |
| | | * 设备类型 |
| | | */ |
| | | @JsonIgnore |
| | | private String type; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Mapper |
| | | public interface AirDataNongGengMapper extends BaseMapper<AirDataNongGeng> { |
| | | List<Long> listAirId(String keyword, Long userid); |
| | | List<Long> listAirId(String keyword, Long userid, String type); |
| | | |
| | | List<AirDataNongGengBo> listAirDataByIds(List<Long> airIdList); |
| | | |
| | | List<AirDataNongGengBo> historyData(String mac); |
| | | } |
| | | |
| | | |
| | |
| | | MAX(t1.id) AS air_id |
| | | FROM |
| | | air_data_nong_geng t1 |
| | | left join air_equipment_nong_geng t4 on t4.mac = t1.mac |
| | | <if test="keyword != null and keyword != ''"> |
| | | LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code |
| | | AND t2.device_type = 11 |
| | |
| | | 1=1 |
| | | <if test="keyword != null and keyword != ''"> |
| | | AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | or t1.mac LIKE CONCAT(CONCAT('%', #{keyword}), '%') |
| | | </if> |
| | | <if test="type != null"> |
| | | AND t4.type = #{type} |
| | | </if> |
| | | <if test="userid != null"> |
| | | AND (t3.user_id = #{userid} OR t3.client_id = #{userid}) |
| | |
| | | </foreach> |
| | | </where> |
| | | </select> |
| | | <select id="historyData" resultType="com.sandu.ximon.dao.bo.AirDataNongGengBo" |
| | | parameterType="java.lang.String"> |
| | | SELECT t1.*, |
| | | t3.id AS pole_id, |
| | | t3.pole_name |
| | | FROM air_data_nong_geng t1 |
| | | LEFT JOIN air_equipment_nong_geng t4 ON t4.mac = t1.mac |
| | | LEFT JOIN pole_binding t2 ON t1.mac = t2.device_code |
| | | AND t2.device_type = 11 |
| | | LEFT JOIN pole t3 ON t3.id = t2.pole_id |
| | | WHERE t1.mac = #{mac} |
| | | ORDER BY t1.id DESC |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | */ |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | |
| | | private final AirDataNongGengService airDataNongGengService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询大气数据模糊查询 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listAirData") |
| | | public ResponseVO<Object> listAirDataByKeyword(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | public ResponseVO<Object> listAirDataByKeyword(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword |
| | | , @RequestParam(value = "type", required = false) String type) { |
| | | if (type == null || type.isEmpty()) { |
| | | throw new BusinessException("数据类型不能为空"); |
| | | } |
| | | if (!permissionConfig.check(MenuEnum.AIR_DATA_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<AirDataNongGengBo> list = airDataNongGengService.listAirDataByKeyword(baseConditionVO, keyword); |
| | | return ResponseUtil.successPage(list); |
| | | List<AirDataNongGengBo> list = airDataNongGengService.listAirDataByKeyword(baseConditionVO, keyword, type); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | |
| | | @GetMapping("/historyData") |
| | | public ResponseVO<Object> historyData(BaseConditionVO baseConditionVO, @RequestParam(value = "mac", required = false) String mac) { |
| | | if (!permissionConfig.check(MenuEnum.AIR_DATA_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<AirDataNongGengBo> list = airDataNongGengService.historyData(baseConditionVO, mac); |
| | | return ResponseUtil.success(list); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereNewHeartbeatReportInnerFrame; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询大气数据(模糊查询) |
| | | */ |
| | | public List<AirDataNongGengBo> listAirDataByKeyword(BaseConditionVO baseConditionVO, String keyword) { |
| | | public List<AirDataNongGengBo> listAirDataByKeyword(BaseConditionVO baseConditionVO, String keyword, String type) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Long> listAirId; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | listAirId = baseMapper.listAirId(keyword, null); |
| | | listAirId = baseMapper.listAirId(keyword, null, type); |
| | | } else { |
| | | listAirId = baseMapper.listAirId(keyword, SecurityUtils.getUserId()); |
| | | listAirId = baseMapper.listAirId(keyword, SecurityUtils.getUserId(), type); |
| | | } |
| | | if (CollUtil.isEmpty(listAirId)) { |
| | | return CollUtil.newArrayList(); |
| | |
| | | return airDataBos; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 设备历史数据 |
| | | * |
| | | * @param baseConditionVO |
| | | * @param mac |
| | | * @return |
| | | */ |
| | | public List<AirDataNongGengBo> historyData(BaseConditionVO baseConditionVO, String mac) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (mac == null || mac.isEmpty()) { |
| | | throw new BusinessException("mac不能为空"); |
| | | } |
| | | List<AirDataNongGengBo> bos = baseMapper.historyData(mac); |
| | | return bos; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | return airEquipmentBos; |
| | | return airEquipmentBos; |
| | | } |
| | | |
| | | /** |