添加获取设备实时数据定时任务等
This commit is contained in:
37
fastbee-service/fastbee-device-service/pom.xml
Normal file
37
fastbee-service/fastbee-device-service/pom.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.fastbee</groupId>
|
||||
<artifactId>fastbee-service</artifactId>
|
||||
<version>3.8.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>fastbee-device-service</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fastbee</groupId>
|
||||
<artifactId>fastbee-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,10 @@
|
||||
package com.fastbee.device.api.renke.constant;
|
||||
|
||||
/**
|
||||
* 建大仁科设备类型常量
|
||||
*/
|
||||
public class RenKeDeviceTypeConstant {
|
||||
public static final String MET = "met";//气象设备
|
||||
public static final String WORM = "wormFlagship";//虫情设备
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.fastbee.device.api.renke.service;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class RenkeDeviceDataService {
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 获取设备实时数据
|
||||
* @param deviceAddrs 设备地址,支持多个用英文逗号分隔
|
||||
*/
|
||||
public void getDeviceRealtimeData(String deviceAddrs) {
|
||||
//处理鉴权
|
||||
String token = getAuth();
|
||||
//获取设备实时数据
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/entrance/device/getRealTimeData")
|
||||
.header("token", token)
|
||||
.form("deviceAddrs", deviceAddrs)
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
throw new RuntimeException("获取设备实时数据失败!");
|
||||
}
|
||||
JSONObject respBody = JSONUtil.parseObj(respBodyStr);
|
||||
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
||||
System.err.println("设备实时数据:"+realtimeDataList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//获取token
|
||||
private String getAuth(){
|
||||
//判断token是否过期
|
||||
String cacheToken = stringRedisTemplate.opsForValue().get("rkckth:user:token");
|
||||
if (!Objects.isNull(cacheToken)){
|
||||
System.err.println("缓存中获取token:"+cacheToken);
|
||||
return cacheToken;
|
||||
}
|
||||
//获取token
|
||||
//构建请求体
|
||||
Map<String,Object> reqBody =new HashMap<>();
|
||||
reqBody.put("loginName","heilongjiang");
|
||||
reqBody.put("loginPwd","123456");
|
||||
|
||||
HttpResponse response = HttpRequest.post("http://api.farm.0531yun.cn/api/v2.0/entrance/user/userLogin")
|
||||
.body(JSONUtil.toJsonStr(reqBody)).execute();
|
||||
System.err.println("响应:"+response.body());
|
||||
String resultObjectStr = response.body();
|
||||
if(StringUtils.isBlank(response.toString())){
|
||||
throw new RuntimeException("获取token失败!");
|
||||
}
|
||||
JSONObject resultObject = JSONUtil.parseObj(resultObjectStr);
|
||||
JSONObject tokenObject = JSONUtil.parseObj(resultObject.get("data"));
|
||||
int currDate = Integer.parseInt(tokenObject.get("currDate").toString());
|
||||
int expDate = Integer.parseInt(tokenObject.get("expDate").toString());
|
||||
Integer periodValidity= expDate - currDate;
|
||||
//将token存入redis
|
||||
stringRedisTemplate.opsForValue().set("rkckth:user:token", tokenObject.get("token").toString(),2, TimeUnit.HOURS);
|
||||
System.err.println("请求获取到token:"+tokenObject.get("token").toString());
|
||||
return stringRedisTemplate.opsForValue().get("rkckth:user:token").toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.fastbee.device.api.renke.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 建大仁科气象设备服务
|
||||
*/
|
||||
@Service
|
||||
public class RenkeMetDeviceService {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.fastbee.device.api.renke.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 建大仁科虫情设备服务
|
||||
*/
|
||||
@Service
|
||||
public class RenkeWormSituationDeviceService {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.fastbee.device.api.yingshiyun.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class YingshiyunService {
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
//获取鉴权
|
||||
public String getAuth(){
|
||||
if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("yingshiyun:user:accessToken"))){
|
||||
return stringRedisTemplate.opsForValue().get("yingshiyun:user:accessToken");
|
||||
}
|
||||
// 鉴权请求
|
||||
String AUTH_URL = "https://open.ys7.com/api/lapp/token/get";
|
||||
String appKey = "b21f910dc7044d668e7625a3c0392e62";
|
||||
String appSecret = "b4beff5f8f6694dd6993c8c5b618417b";
|
||||
// 构建请求体参数
|
||||
String body = StrUtil.format("appKey={}&appSecret={}", appKey, appSecret);
|
||||
HttpResponse response = HttpRequest.post(AUTH_URL)
|
||||
.body(body).execute();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(response.body());
|
||||
String accessToken = JSONUtil.parseObj(jsonObject.get("data")).get("accessToken").toString();
|
||||
stringRedisTemplate.opsForValue().set("yingshiyun:user:accessToken",accessToken, 60*60*24*6);
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
//获取视频播放地址
|
||||
public String getVideoPlayUrl(String deviceSerial){
|
||||
String accessToken = getAuth();
|
||||
String VIDEO_PLAY_URL = "https://open.ys7.com/api/lapp/v2/live/address/get";
|
||||
String body = StrUtil.format("accessToken={}&deviceSerial={}",accessToken ,deviceSerial );
|
||||
HttpResponse response = HttpRequest.post(VIDEO_PLAY_URL)
|
||||
.form(body).execute();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(response.body());
|
||||
String videoPlayUrl = JSONUtil.parseObj(jsonObject.get("data")).get("url").toString();
|
||||
String expireTime = JSONUtil.parseObj(jsonObject.get("data")).get("expireTime").toString();
|
||||
Map<String, Object> resp= new HashMap<>();
|
||||
resp.put("videoPlayUrl",videoPlayUrl);
|
||||
resp.put("expireTime",expireTime);
|
||||
resp.put("deviceSerial",deviceSerial);
|
||||
return videoPlayUrl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
YingshiyunService yingshiyunService = new YingshiyunService();
|
||||
yingshiyunService.getAuth();
|
||||
long timeStamp = 1731571309231L;
|
||||
Date date = new Date(timeStamp);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
sdf.setTimeZone(java.util.TimeZone.getTimeZone("Asia/Shanghai"));
|
||||
String formattedDate = sdf.format(date);
|
||||
System.out.println(formattedDate);
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.fastbee.device.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 虫情设备实时数据对象 iot_device_realtimedata_worms
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-07
|
||||
*/
|
||||
@ApiModel(value = "DeviceRealtimedataWorms",description = "虫情设备实时数据 iot_device_realtimedata_worms")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeviceRealtimedataWorms extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
@ApiModelProperty("设备编号")
|
||||
private String deviceAddr;
|
||||
|
||||
/** 降雨状态 */
|
||||
@Excel(name = "降雨状态")
|
||||
@ApiModelProperty("降雨状态")
|
||||
private String rain;
|
||||
|
||||
/** 杀虫挡板(0:关闭;1:打开) */
|
||||
@Excel(name = "杀虫挡板", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("杀虫挡板")
|
||||
private String wormFlap;
|
||||
|
||||
/** 杀虫仓温度 */
|
||||
@Excel(name = "杀虫仓温度")
|
||||
@ApiModelProperty("杀虫仓温度")
|
||||
private String insecticideTem;
|
||||
|
||||
/** 震动装置(0:关闭;1:打开) */
|
||||
@Excel(name = "震动装置", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("震动装置")
|
||||
private String shake;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
@ApiModelProperty("经度")
|
||||
private String lng;
|
||||
|
||||
/** 烘干挡板(0:关闭;1:打开) */
|
||||
@Excel(name = "烘干挡板", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("烘干挡板")
|
||||
private String dryingFlap;
|
||||
|
||||
/** 杀虫控制(0:关闭;1:打开) */
|
||||
@Excel(name = "杀虫控制", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("杀虫控制")
|
||||
private String insecticide;
|
||||
|
||||
/** 移虫挡板(0:关闭;1:打开) */
|
||||
@Excel(name = "移虫挡板", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("移虫挡板")
|
||||
private String moveWorm;
|
||||
|
||||
/** 运行模式(1:自动;0:手动) */
|
||||
@Excel(name = "运行模式", readConverterExp = "1=:自动;0:手动")
|
||||
@ApiModelProperty("运行模式")
|
||||
private String mode;
|
||||
|
||||
/** 烘干控制(0:关闭;1:打开) */
|
||||
@Excel(name = "烘干控制", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("烘干控制")
|
||||
private String drying;
|
||||
|
||||
/** 虫雨挡板(0:关闭;1:打开) */
|
||||
@Excel(name = "虫雨挡板", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("虫雨挡板")
|
||||
private String rainFlap;
|
||||
|
||||
/** 诱虫灯状态(0:关闭;1:打开) */
|
||||
@Excel(name = "诱虫灯状态", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("诱虫灯状态")
|
||||
private String attractWorm;
|
||||
|
||||
/** 光照度 */
|
||||
@Excel(name = "光照度")
|
||||
@ApiModelProperty("光照度")
|
||||
private String illum;
|
||||
|
||||
/** 烘干仓温度 */
|
||||
@Excel(name = "烘干仓温度")
|
||||
@ApiModelProperty("烘干仓温度")
|
||||
private String dryingTem;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
@ApiModelProperty("纬度")
|
||||
private String lat;
|
||||
|
||||
/** 补光灯(0:关闭;1:打开) */
|
||||
@Excel(name = "补光灯", readConverterExp = "0=:关闭;1:打开")
|
||||
@ApiModelProperty("补光灯")
|
||||
private String fillLight;
|
||||
|
||||
/** 设备状态(online/offline) */
|
||||
@Excel(name = "设备状态", readConverterExp = "o=nline/offline")
|
||||
@ApiModelProperty("设备状态")
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.device.domain.DeviceRealtimedataWorms;
|
||||
|
||||
/**
|
||||
* 虫情设备实时数据Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-07
|
||||
*/
|
||||
public interface DeviceRealtimedataWormsMapper
|
||||
{
|
||||
/**
|
||||
* 查询虫情设备实时数据
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 虫情设备实时数据
|
||||
*/
|
||||
public DeviceRealtimedataWorms selectDeviceRealtimedataWormsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询虫情设备实时数据列表
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 虫情设备实时数据集合
|
||||
*/
|
||||
public List<DeviceRealtimedataWorms> selectDeviceRealtimedataWormsList(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 新增虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 修改虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 删除虫情设备实时数据
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceRealtimedataWormsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除虫情设备实时数据
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceRealtimedataWormsByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.device.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.device.domain.DeviceRealtimedataWorms;
|
||||
|
||||
/**
|
||||
* 虫情设备实时数据Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-07
|
||||
*/
|
||||
public interface IDeviceRealtimedataWormsService
|
||||
{
|
||||
/**
|
||||
* 查询虫情设备实时数据
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 虫情设备实时数据
|
||||
*/
|
||||
public DeviceRealtimedataWorms selectDeviceRealtimedataWormsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询虫情设备实时数据列表
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 虫情设备实时数据集合
|
||||
*/
|
||||
public List<DeviceRealtimedataWorms> selectDeviceRealtimedataWormsList(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 新增虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 修改虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms);
|
||||
|
||||
/**
|
||||
* 批量删除虫情设备实时数据
|
||||
*
|
||||
* @param ids 需要删除的虫情设备实时数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceRealtimedataWormsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除虫情设备实时数据信息
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceRealtimedataWormsById(Long id);
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.fastbee.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.device.mapper.DeviceRealtimedataWormsMapper;
|
||||
import com.fastbee.device.domain.DeviceRealtimedataWorms;
|
||||
import com.fastbee.device.service.IDeviceRealtimedataWormsService;
|
||||
|
||||
/**
|
||||
* 虫情设备实时数据Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-07
|
||||
*/
|
||||
@Service
|
||||
public class DeviceRealtimedataWormsServiceImpl implements IDeviceRealtimedataWormsService
|
||||
{
|
||||
@Autowired
|
||||
private DeviceRealtimedataWormsMapper deviceRealtimedataWormsMapper;
|
||||
|
||||
/**
|
||||
* 查询虫情设备实时数据
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 虫情设备实时数据
|
||||
*/
|
||||
@Override
|
||||
public DeviceRealtimedataWorms selectDeviceRealtimedataWormsById(Long id)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.selectDeviceRealtimedataWormsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询虫情设备实时数据列表
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 虫情设备实时数据
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceRealtimedataWorms> selectDeviceRealtimedataWormsList(DeviceRealtimedataWorms deviceRealtimedataWorms)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.selectDeviceRealtimedataWormsList(deviceRealtimedataWorms);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.insertDeviceRealtimedataWorms(deviceRealtimedataWorms);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改虫情设备实时数据
|
||||
*
|
||||
* @param deviceRealtimedataWorms 虫情设备实时数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDeviceRealtimedataWorms(DeviceRealtimedataWorms deviceRealtimedataWorms)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.updateDeviceRealtimedataWorms(deviceRealtimedataWorms);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除虫情设备实时数据
|
||||
*
|
||||
* @param ids 需要删除的虫情设备实时数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceRealtimedataWormsByIds(Long[] ids)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.deleteDeviceRealtimedataWormsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除虫情设备实时数据信息
|
||||
*
|
||||
* @param id 虫情设备实时数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceRealtimedataWormsById(Long id)
|
||||
{
|
||||
return deviceRealtimedataWormsMapper.deleteDeviceRealtimedataWormsById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fastbee.deviceData.mapper.DeviceRealtimedataWormsMapper">
|
||||
|
||||
<resultMap type="DeviceRealtimedataWorms" id="DeviceRealtimedataWormsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deviceAddr" column="device_addr" />
|
||||
<result property="rain" column="rain" />
|
||||
<result property="wormFlap" column="worm_flap" />
|
||||
<result property="insecticideTem" column="insecticide_tem" />
|
||||
<result property="shake" column="shake" />
|
||||
<result property="lng" column="lng" />
|
||||
<result property="dryingFlap" column="drying_flap" />
|
||||
<result property="insecticide" column="insecticide" />
|
||||
<result property="moveWorm" column="move_worm" />
|
||||
<result property="mode" column="mode" />
|
||||
<result property="drying" column="drying" />
|
||||
<result property="rainFlap" column="rain_flap" />
|
||||
<result property="attractWorm" column="attract_worm" />
|
||||
<result property="illum" column="illum" />
|
||||
<result property="dryingTem" column="drying_tem" />
|
||||
<result property="lat" column="lat" />
|
||||
<result property="fillLight" column="fill_light" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceRealtimedataWormsVo">
|
||||
select id, device_addr, rain, worm_flap, insecticide_tem, shake, lng, drying_flap, insecticide, move_worm, mode, drying, rain_flap, attract_worm, illum, drying_tem, lat, fill_light, status from iot_device_realtimedata_worms
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceRealtimedataWormsList" parameterType="DeviceRealtimedataWorms" resultMap="DeviceRealtimedataWormsResult">
|
||||
<include refid="selectDeviceRealtimedataWormsVo"/>
|
||||
<where>
|
||||
<if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if>
|
||||
<if test="rain != null and rain != ''"> and rain = #{rain}</if>
|
||||
<if test="wormFlap != null and wormFlap != ''"> and worm_flap = #{wormFlap}</if>
|
||||
<if test="insecticideTem != null and insecticideTem != ''"> and insecticide_tem = #{insecticideTem}</if>
|
||||
<if test="shake != null and shake != ''"> and shake = #{shake}</if>
|
||||
<if test="lng != null and lng != ''"> and lng = #{lng}</if>
|
||||
<if test="dryingFlap != null and dryingFlap != ''"> and drying_flap = #{dryingFlap}</if>
|
||||
<if test="insecticide != null and insecticide != ''"> and insecticide = #{insecticide}</if>
|
||||
<if test="moveWorm != null and moveWorm != ''"> and move_worm = #{moveWorm}</if>
|
||||
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
|
||||
<if test="drying != null and drying != ''"> and drying = #{drying}</if>
|
||||
<if test="rainFlap != null and rainFlap != ''"> and rain_flap = #{rainFlap}</if>
|
||||
<if test="attractWorm != null and attractWorm != ''"> and attract_worm = #{attractWorm}</if>
|
||||
<if test="illum != null and illum != ''"> and illum = #{illum}</if>
|
||||
<if test="dryingTem != null and dryingTem != ''"> and drying_tem = #{dryingTem}</if>
|
||||
<if test="lat != null and lat != ''"> and lat = #{lat}</if>
|
||||
<if test="fillLight != null and fillLight != ''"> and fill_light = #{fillLight}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceRealtimedataWormsById" parameterType="Long" resultMap="DeviceRealtimedataWormsResult">
|
||||
<include refid="selectDeviceRealtimedataWormsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceRealtimedataWorms" parameterType="DeviceRealtimedataWorms" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into iot_device_realtimedata_worms
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceAddr != null">device_addr,</if>
|
||||
<if test="rain != null">rain,</if>
|
||||
<if test="wormFlap != null">worm_flap,</if>
|
||||
<if test="insecticideTem != null">insecticide_tem,</if>
|
||||
<if test="shake != null">shake,</if>
|
||||
<if test="lng != null">lng,</if>
|
||||
<if test="dryingFlap != null">drying_flap,</if>
|
||||
<if test="insecticide != null">insecticide,</if>
|
||||
<if test="moveWorm != null">move_worm,</if>
|
||||
<if test="mode != null">mode,</if>
|
||||
<if test="drying != null">drying,</if>
|
||||
<if test="rainFlap != null">rain_flap,</if>
|
||||
<if test="attractWorm != null">attract_worm,</if>
|
||||
<if test="illum != null">illum,</if>
|
||||
<if test="dryingTem != null">drying_tem,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
<if test="fillLight != null">fill_light,</if>
|
||||
<if test="status != null">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceAddr != null">#{deviceAddr},</if>
|
||||
<if test="rain != null">#{rain},</if>
|
||||
<if test="wormFlap != null">#{wormFlap},</if>
|
||||
<if test="insecticideTem != null">#{insecticideTem},</if>
|
||||
<if test="shake != null">#{shake},</if>
|
||||
<if test="lng != null">#{lng},</if>
|
||||
<if test="dryingFlap != null">#{dryingFlap},</if>
|
||||
<if test="insecticide != null">#{insecticide},</if>
|
||||
<if test="moveWorm != null">#{moveWorm},</if>
|
||||
<if test="mode != null">#{mode},</if>
|
||||
<if test="drying != null">#{drying},</if>
|
||||
<if test="rainFlap != null">#{rainFlap},</if>
|
||||
<if test="attractWorm != null">#{attractWorm},</if>
|
||||
<if test="illum != null">#{illum},</if>
|
||||
<if test="dryingTem != null">#{dryingTem},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
<if test="fillLight != null">#{fillLight},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceRealtimedataWorms" parameterType="DeviceRealtimedataWorms">
|
||||
update iot_device_realtimedata_worms
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceAddr != null">device_addr = #{deviceAddr},</if>
|
||||
<if test="rain != null">rain = #{rain},</if>
|
||||
<if test="wormFlap != null">worm_flap = #{wormFlap},</if>
|
||||
<if test="insecticideTem != null">insecticide_tem = #{insecticideTem},</if>
|
||||
<if test="shake != null">shake = #{shake},</if>
|
||||
<if test="lng != null">lng = #{lng},</if>
|
||||
<if test="dryingFlap != null">drying_flap = #{dryingFlap},</if>
|
||||
<if test="insecticide != null">insecticide = #{insecticide},</if>
|
||||
<if test="moveWorm != null">move_worm = #{moveWorm},</if>
|
||||
<if test="mode != null">mode = #{mode},</if>
|
||||
<if test="drying != null">drying = #{drying},</if>
|
||||
<if test="rainFlap != null">rain_flap = #{rainFlap},</if>
|
||||
<if test="attractWorm != null">attract_worm = #{attractWorm},</if>
|
||||
<if test="illum != null">illum = #{illum},</if>
|
||||
<if test="dryingTem != null">drying_tem = #{dryingTem},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
<if test="fillLight != null">fill_light = #{fillLight},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceRealtimedataWormsById" parameterType="Long">
|
||||
delete from iot_device_realtimedata_worms where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeviceRealtimedataWormsByIds" parameterType="String">
|
||||
delete from iot_device_realtimedata_worms where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user