Merge branch 'master' of https://gitlink.org.cn/xuos/xiuos_IoT
This commit is contained in:
commit
25d84f0352
|
@ -0,0 +1,24 @@
|
|||
package com.aiit.xiuos.dao.mappers;
|
||||
|
||||
import com.aiit.xiuos.model.GZJCData;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface GZJCDataMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(GZJCData record);
|
||||
|
||||
int insertSelective(GZJCData record);
|
||||
|
||||
GZJCData selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(GZJCData record);
|
||||
|
||||
int updateByPrimaryKey(GZJCData record);
|
||||
|
||||
|
||||
@Select("select * from haier_data order by time desc limit 1")
|
||||
GZJCData selectData();
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.aiit.xiuos.dao.mappers;
|
||||
|
||||
import com.aiit.xiuos.model.HaierData;
|
||||
|
||||
public interface HaierDataMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(HaierData record);
|
||||
|
||||
int insertSelective(HaierData record);
|
||||
|
||||
HaierData selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(HaierData record);
|
||||
|
||||
int updateByPrimaryKey(HaierData record);
|
||||
}
|
|
@ -7,7 +7,7 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
@Builder
|
||||
public class HaierData {
|
||||
public class GZJCData {
|
||||
private Integer id;
|
||||
|
||||
private BigDecimal o3;
|
||||
|
@ -52,7 +52,7 @@ public class HaierData {
|
|||
|
||||
private BigDecimal noise;
|
||||
|
||||
public HaierData(Integer id, BigDecimal o3, BigDecimal co2, BigDecimal so2, BigDecimal no2, BigDecimal nh3, BigDecimal tvoc, BigDecimal ch2o, BigDecimal c2h5oh, BigDecimal ch4, BigDecimal o2, BigDecimal aqs, BigDecimal humidness, BigDecimal temperature, BigDecimal pm1d0, BigDecimal pm2d5, BigDecimal pm10, BigDecimal windspeed, BigDecimal winddirection, BigDecimal airpressure, Date time, BigDecimal noise) {
|
||||
public GZJCData(Integer id, BigDecimal o3, BigDecimal co2, BigDecimal so2, BigDecimal no2, BigDecimal nh3, BigDecimal tvoc, BigDecimal ch2o, BigDecimal c2h5oh, BigDecimal ch4, BigDecimal o2, BigDecimal aqs, BigDecimal humidness, BigDecimal temperature, BigDecimal pm1d0, BigDecimal pm2d5, BigDecimal pm10, BigDecimal windspeed, BigDecimal winddirection, BigDecimal airpressure, Date time, BigDecimal noise) {
|
||||
this.id = id;
|
||||
this.o3 = o3;
|
||||
this.co2 = co2;
|
||||
|
@ -77,7 +77,7 @@ public class HaierData {
|
|||
this.noise = noise;
|
||||
}
|
||||
|
||||
public HaierData() {
|
||||
public GZJCData() {
|
||||
super();
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@ package com.aiit.xiuos.scheduled;
|
|||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.aiit.xiuos.Utils.MyUtils;
|
||||
import com.aiit.xiuos.model.HaierData;
|
||||
import com.aiit.xiuos.service.HaierService;
|
||||
import com.aiit.xiuos.socket.HaiErWebSocketServer;
|
||||
import com.aiit.xiuos.model.GZJCData;
|
||||
import com.aiit.xiuos.service.GZJCService;
|
||||
import com.aiit.xiuos.socket.GZJCWebSocketServer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
@ -20,98 +20,98 @@ import java.util.Date;
|
|||
import java.util.Random;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class HaierDataTaskScheduled {
|
||||
public class GZJCTaskScheduled {
|
||||
@Autowired
|
||||
HaiErWebSocketServer haiErWebSocketServer;
|
||||
GZJCWebSocketServer GZJCWebSocketServer;
|
||||
|
||||
@Autowired
|
||||
HaierService haierService;
|
||||
GZJCService GZJCService;
|
||||
|
||||
@Scheduled(cron = "0 0 */1 * * ?")//every hour
|
||||
public void insertHaierData() throws ParseException {
|
||||
HaierData haierData =mockData();
|
||||
haierService.insertData(haierData);
|
||||
GZJCData GZJCData =mockData();
|
||||
GZJCService.insertData(GZJCData);
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(cron = "*/1 * * * * ?")//every hour
|
||||
public void sendWebsocket() throws ParseException, IOException {
|
||||
HaierData haierData = mockData();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(haierData,false,true);
|
||||
haiErWebSocketServer.sendInfo(jsonObject.toString());
|
||||
GZJCData GZJCData = mockData();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(GZJCData,false,true);
|
||||
GZJCWebSocketServer.sendInfo(jsonObject.toString());
|
||||
}
|
||||
|
||||
public HaierData mockData() throws ParseException {
|
||||
HaierData haierData =new HaierData();
|
||||
public GZJCData mockData() throws ParseException {
|
||||
GZJCData GZJCData =new GZJCData();
|
||||
Random rand = new Random();
|
||||
DecimalFormat df = new DecimalFormat("#.00"); //保留两位数,若数据库已截取,java可不作保留
|
||||
//生成在max与min之间的随机数
|
||||
// int randNumber = rand.nextInt(MAX - MIN + 1) + MIN;
|
||||
|
||||
double o3 =rand.nextInt(10)+30+Math.random(); //O3
|
||||
haierData.setO3(new BigDecimal(df.format(o3)));
|
||||
GZJCData.setO3(new BigDecimal(df.format(o3)));
|
||||
|
||||
double co2 =rand.nextInt(100)+200+Math.random(); //co2
|
||||
haierData.setCo2(new BigDecimal(df.format(co2)));
|
||||
GZJCData.setCo2(new BigDecimal(df.format(co2)));
|
||||
|
||||
double so2=0.0; //so2
|
||||
haierData.setSo2(new BigDecimal(df.format(so2)));
|
||||
GZJCData.setSo2(new BigDecimal(df.format(so2)));
|
||||
|
||||
double no2=0.0; //no2
|
||||
haierData.setNo2(new BigDecimal(df.format(no2)));
|
||||
GZJCData.setNo2(new BigDecimal(df.format(no2)));
|
||||
|
||||
double nh3=0.0; //nh3
|
||||
haierData.setNh3(new BigDecimal(df.format(nh3)));
|
||||
GZJCData.setNh3(new BigDecimal(df.format(nh3)));
|
||||
|
||||
double tvoc = rand.nextInt(1)+Math.random(); //tvoc
|
||||
haierData.setTvoc(new BigDecimal(df.format(tvoc)));
|
||||
GZJCData.setTvoc(new BigDecimal(df.format(tvoc)));
|
||||
|
||||
double ch2o =0.0; //ch2o
|
||||
haierData.setCh2o(new BigDecimal(df.format(ch2o)));
|
||||
GZJCData.setCh2o(new BigDecimal(df.format(ch2o)));
|
||||
|
||||
double c2h5oh = rand.nextInt(10)+Math.random(); //c2h5oh
|
||||
haierData.setC2h5oh(new BigDecimal(df.format(c2h5oh)));
|
||||
GZJCData.setC2h5oh(new BigDecimal(df.format(c2h5oh)));
|
||||
|
||||
double ch4 = 0.0; //ch4
|
||||
haierData.setCh4(new BigDecimal(df.format(ch4)));
|
||||
GZJCData.setCh4(new BigDecimal(df.format(ch4)));
|
||||
|
||||
double o2 = rand.nextInt(10)+20+Math.random(); //o2
|
||||
haierData.setO2(new BigDecimal(df.format(o2)));
|
||||
GZJCData.setO2(new BigDecimal(df.format(o2)));
|
||||
|
||||
double aqs = rand.nextInt(30)+200+Math.random(); //aqs
|
||||
haierData.setAqs(new BigDecimal(df.format(aqs)));
|
||||
GZJCData.setAqs(new BigDecimal(df.format(aqs)));
|
||||
|
||||
double humidness = rand.nextInt(30)+30+Math.random(); //湿度
|
||||
haierData.setHumidness(new BigDecimal(df.format(humidness)));
|
||||
GZJCData.setHumidness(new BigDecimal(df.format(humidness)));
|
||||
|
||||
double temperature =rand.nextInt(10)+15+Math.random(); //温度
|
||||
haierData.setTemperature(new BigDecimal(df.format(temperature)));
|
||||
GZJCData.setTemperature(new BigDecimal(df.format(temperature)));
|
||||
|
||||
double pm1_0=rand.nextInt(20)+Math.random(); //pm1.0 ug/m3
|
||||
haierData.setPm1d0(new BigDecimal(df.format(pm1_0)));
|
||||
GZJCData.setPm1d0(new BigDecimal(df.format(pm1_0)));
|
||||
|
||||
double pm2_5=rand.nextInt(20)+30+Math.random(); //pm2.5 ug/m3
|
||||
haierData.setPm2d5(new BigDecimal(df.format(pm2_5)));
|
||||
GZJCData.setPm2d5(new BigDecimal(df.format(pm2_5)));
|
||||
|
||||
double pm10=rand.nextInt(20)+50+Math.random(); //pm10 ug/m3
|
||||
haierData.setPm10(new BigDecimal(df.format(pm10)));
|
||||
GZJCData.setPm10(new BigDecimal(df.format(pm10)));
|
||||
|
||||
double windspeed = Math.random(); //风速m/s
|
||||
haierData.setWindspeed(new BigDecimal(df.format(windspeed)));
|
||||
GZJCData.setWindspeed(new BigDecimal(df.format(windspeed)));
|
||||
|
||||
double winddirection = rand.nextInt(30)+200; //风向
|
||||
haierData.setWinddirection(new BigDecimal(df.format(winddirection)));
|
||||
GZJCData.setWinddirection(new BigDecimal(df.format(winddirection)));
|
||||
|
||||
double airpressure=rand.nextInt(100)+900+Math.random(); //气压
|
||||
haierData.setAirpressure(new BigDecimal(df.format(airpressure)));
|
||||
GZJCData.setAirpressure(new BigDecimal(df.format(airpressure)));
|
||||
|
||||
double noise =rand.nextInt(71)+30+Math.random(); //噪音 pd
|
||||
haierData.setNoise(new BigDecimal(df.format(noise)));
|
||||
GZJCData.setNoise(new BigDecimal(df.format(noise)));
|
||||
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = sdf.parse(MyUtils.getTime());
|
||||
haierData.setTime(date);
|
||||
return haierData;
|
||||
GZJCData.setTime(date);
|
||||
return GZJCData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.aiit.xiuos.service;
|
||||
|
||||
import com.aiit.xiuos.model.GZJCData;
|
||||
|
||||
public interface GZJCService {
|
||||
int insertData(GZJCData data);
|
||||
GZJCData selectData();
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.aiit.xiuos.service;
|
||||
|
||||
import com.aiit.xiuos.model.HaierData;
|
||||
|
||||
public interface HaierService {
|
||||
int insertData(HaierData data);
|
||||
HaierData selectData();
|
||||
}
|
|
@ -1,22 +1,23 @@
|
|||
package com.aiit.xiuos.service.impl;
|
||||
|
||||
import com.aiit.xiuos.dao.mappers.HaierDataMapper;
|
||||
import com.aiit.xiuos.model.HaierData;
|
||||
import com.aiit.xiuos.service.HaierService;
|
||||
|
||||
import com.aiit.xiuos.dao.mappers.GZJCDataMapper;
|
||||
import com.aiit.xiuos.model.GZJCData;
|
||||
import com.aiit.xiuos.service.GZJCService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HaierServiceImpl implements HaierService {
|
||||
public class GZJCServiceImpl implements GZJCService {
|
||||
@Autowired
|
||||
HaierDataMapper haierDataMapper;
|
||||
GZJCDataMapper haierDataMapper;
|
||||
@Override
|
||||
public int insertData(HaierData data) {
|
||||
public int insertData(GZJCData data) {
|
||||
return haierDataMapper.insertSelective(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HaierData selectData() {
|
||||
public GZJCData selectData() {
|
||||
return haierDataMapper.selectData();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
package com.aiit.xiuos.socket;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ServerEndpoint(value = "/websocket/haier/{clientId}")
|
||||
@Component
|
||||
@Slf4j
|
||||
public class GZJCWebSocketServer {
|
||||
/**
|
||||
* 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
|
||||
*/
|
||||
private static int onlineCount = 0;
|
||||
|
||||
/**
|
||||
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
|
||||
*/
|
||||
public static ConcurrentHashMap<String, com.aiit.xiuos.socket.GZJCWebSocketServer> webSocketSet = new ConcurrentHashMap<String, com.aiit.xiuos.socket.GZJCWebSocketServer>();
|
||||
|
||||
public HashMap<String, Integer> cntofParam = new HashMap<String, Integer>();
|
||||
|
||||
public HashMap<String, Integer> numofAccount = new HashMap<String, Integer>();
|
||||
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
*/
|
||||
private Session session;
|
||||
|
||||
/**
|
||||
* 传过来的id
|
||||
*/
|
||||
private String name = "";
|
||||
|
||||
/**
|
||||
* 连接建立成功调用的方法
|
||||
*/
|
||||
@OnOpen
|
||||
public void onOpen(@PathParam(value = "clientId") String clientId, Session session) {
|
||||
//接收到发送消息的人员编号
|
||||
name = clientId;
|
||||
this.session = session;
|
||||
/**加入set中*/
|
||||
webSocketSet.put(clientId, this);
|
||||
/**在线数加1*/
|
||||
addOnlineCount();
|
||||
log.info("有新连接" + clientId + "加入!当前在线人数为" + getOnlineCount());
|
||||
try {
|
||||
sendMessage(clientId + "-连接已建立-");
|
||||
} catch (IOException e) {
|
||||
log.error("IO异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接关闭调用的方法
|
||||
*/
|
||||
@OnClose
|
||||
public void onClose() {
|
||||
if (name != null && name != "") {
|
||||
/** 从set中删除 */
|
||||
webSocketSet.remove(name);
|
||||
/** 在线数减1 */
|
||||
subOnlineCount();
|
||||
log.info("有一连接" + name + "关闭!当前在线人数为" + getOnlineCount());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收到客户端消息后调用的方法
|
||||
*
|
||||
* @param message 客户端发送过来的消息
|
||||
*/
|
||||
@OnMessage
|
||||
public void onMessage(String message, Session session) {
|
||||
log.info("来自客户端的消息:" + message);
|
||||
try {
|
||||
this.sendMessage("收到!");
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发生错误时调用
|
||||
**/
|
||||
@OnError
|
||||
public void onError(Session session, Throwable error) {
|
||||
log.error("发生错误");
|
||||
error.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
public void sendMessage(String message) throws IOException {
|
||||
synchronized (session) {
|
||||
getSession().getBasicRemote().sendText(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 给指定的人发送消息
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void sendToMessageById(String id, String message) {
|
||||
try {
|
||||
if (webSocketSet.get(id) != null) {
|
||||
webSocketSet.get(id).sendMessage(message);
|
||||
} else {
|
||||
System.out.println("webSocketSet中没有此key,不推送消息");
|
||||
log.info("webSocketSet中没有此key,不推送消息");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 群发自定义消息
|
||||
*/
|
||||
public static void sendInfo(String message) {
|
||||
try {
|
||||
for (Map.Entry<String, com.aiit.xiuos.socket.GZJCWebSocketServer> entry : webSocketSet.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
log.info("发送信息至客户端:" + name);
|
||||
com.aiit.xiuos.socket.GZJCWebSocketServer value = entry.getValue();
|
||||
value.sendMessage(message);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Session getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public static synchronized int getOnlineCount() {
|
||||
return onlineCount;
|
||||
}
|
||||
|
||||
public static synchronized void addOnlineCount() {
|
||||
com.aiit.xiuos.socket.GZJCWebSocketServer.onlineCount++;
|
||||
}
|
||||
|
||||
public static synchronized void subOnlineCount() {
|
||||
com.aiit.xiuos.socket.GZJCWebSocketServer.onlineCount--;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,295 @@
|
|||
<?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.aiit.xiuos.dao.mappers.GZJCDataMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aiit.xiuos.model.GZJCData">
|
||||
<constructor>
|
||||
<idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
||||
<arg column="o3" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="co2" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="so2" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="no2" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="nh3" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="tvoc" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="ch2o" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="c2h5oh" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="ch4" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="o2" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="aqs" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="humidness" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="temperature" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="pm1d0" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="pm2d5" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="pm10" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="windspeed" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="winddirection" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="airpressure" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
<arg column="time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
||||
<arg column="noise" javaType="java.math.BigDecimal" jdbcType="NUMERIC" />
|
||||
</constructor>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, o3, co2, so2, no2, nh3, tvoc, ch2o, c2h5oh, ch4, o2, aqs, humidness, temperature,
|
||||
pm1d0, pm2d5, pm10, windspeed, winddirection, airpressure, time, noise
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from haier_data
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from haier_data
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.aiit.xiuos.model.GZJCData">
|
||||
insert into haier_data (id, o3, co2,
|
||||
so2, no2, nh3, tvoc,
|
||||
ch2o, c2h5oh, ch4,
|
||||
o2, aqs, humidness,
|
||||
temperature, pm1d0, pm2d5,
|
||||
pm10, windspeed, winddirection,
|
||||
airpressure, time, noise
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{o3,jdbcType=NUMERIC}, #{co2,jdbcType=NUMERIC},
|
||||
#{so2,jdbcType=NUMERIC}, #{no2,jdbcType=NUMERIC}, #{nh3,jdbcType=NUMERIC}, #{tvoc,jdbcType=NUMERIC},
|
||||
#{ch2o,jdbcType=NUMERIC}, #{c2h5oh,jdbcType=NUMERIC}, #{ch4,jdbcType=NUMERIC},
|
||||
#{o2,jdbcType=NUMERIC}, #{aqs,jdbcType=NUMERIC}, #{humidness,jdbcType=NUMERIC},
|
||||
#{temperature,jdbcType=NUMERIC}, #{pm1d0,jdbcType=NUMERIC}, #{pm2d5,jdbcType=NUMERIC},
|
||||
#{pm10,jdbcType=NUMERIC}, #{windspeed,jdbcType=NUMERIC}, #{winddirection,jdbcType=NUMERIC},
|
||||
#{airpressure,jdbcType=NUMERIC}, #{time,jdbcType=TIMESTAMP}, #{noise,jdbcType=NUMERIC}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.aiit.xiuos.model.GZJCData">
|
||||
insert into haier_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="o3 != null">
|
||||
o3,
|
||||
</if>
|
||||
<if test="co2 != null">
|
||||
co2,
|
||||
</if>
|
||||
<if test="so2 != null">
|
||||
so2,
|
||||
</if>
|
||||
<if test="no2 != null">
|
||||
no2,
|
||||
</if>
|
||||
<if test="nh3 != null">
|
||||
nh3,
|
||||
</if>
|
||||
<if test="tvoc != null">
|
||||
tvoc,
|
||||
</if>
|
||||
<if test="ch2o != null">
|
||||
ch2o,
|
||||
</if>
|
||||
<if test="c2h5oh != null">
|
||||
c2h5oh,
|
||||
</if>
|
||||
<if test="ch4 != null">
|
||||
ch4,
|
||||
</if>
|
||||
<if test="o2 != null">
|
||||
o2,
|
||||
</if>
|
||||
<if test="aqs != null">
|
||||
aqs,
|
||||
</if>
|
||||
<if test="humidness != null">
|
||||
humidness,
|
||||
</if>
|
||||
<if test="temperature != null">
|
||||
temperature,
|
||||
</if>
|
||||
<if test="pm1d0 != null">
|
||||
pm1d0,
|
||||
</if>
|
||||
<if test="pm2d5 != null">
|
||||
pm2d5,
|
||||
</if>
|
||||
<if test="pm10 != null">
|
||||
pm10,
|
||||
</if>
|
||||
<if test="windspeed != null">
|
||||
windspeed,
|
||||
</if>
|
||||
<if test="winddirection != null">
|
||||
winddirection,
|
||||
</if>
|
||||
<if test="airpressure != null">
|
||||
airpressure,
|
||||
</if>
|
||||
<if test="time != null">
|
||||
time,
|
||||
</if>
|
||||
<if test="noise != null">
|
||||
noise,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="o3 != null">
|
||||
#{o3,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="co2 != null">
|
||||
#{co2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="so2 != null">
|
||||
#{so2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="no2 != null">
|
||||
#{no2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="nh3 != null">
|
||||
#{nh3,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="tvoc != null">
|
||||
#{tvoc,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="ch2o != null">
|
||||
#{ch2o,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="c2h5oh != null">
|
||||
#{c2h5oh,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="ch4 != null">
|
||||
#{ch4,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="o2 != null">
|
||||
#{o2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="aqs != null">
|
||||
#{aqs,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="humidness != null">
|
||||
#{humidness,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="temperature != null">
|
||||
#{temperature,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm1d0 != null">
|
||||
#{pm1d0,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm2d5 != null">
|
||||
#{pm2d5,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm10 != null">
|
||||
#{pm10,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="windspeed != null">
|
||||
#{windspeed,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="winddirection != null">
|
||||
#{winddirection,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="airpressure != null">
|
||||
#{airpressure,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="time != null">
|
||||
#{time,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="noise != null">
|
||||
#{noise,jdbcType=NUMERIC},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.GZJCData">
|
||||
update haier_data
|
||||
<set>
|
||||
<if test="o3 != null">
|
||||
o3 = #{o3,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="co2 != null">
|
||||
co2 = #{co2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="so2 != null">
|
||||
so2 = #{so2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="no2 != null">
|
||||
no2 = #{no2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="nh3 != null">
|
||||
nh3 = #{nh3,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="tvoc != null">
|
||||
tvoc = #{tvoc,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="ch2o != null">
|
||||
ch2o = #{ch2o,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="c2h5oh != null">
|
||||
c2h5oh = #{c2h5oh,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="ch4 != null">
|
||||
ch4 = #{ch4,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="o2 != null">
|
||||
o2 = #{o2,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="aqs != null">
|
||||
aqs = #{aqs,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="humidness != null">
|
||||
humidness = #{humidness,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="temperature != null">
|
||||
temperature = #{temperature,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm1d0 != null">
|
||||
pm1d0 = #{pm1d0,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm2d5 != null">
|
||||
pm2d5 = #{pm2d5,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="pm10 != null">
|
||||
pm10 = #{pm10,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="windspeed != null">
|
||||
windspeed = #{windspeed,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="winddirection != null">
|
||||
winddirection = #{winddirection,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="airpressure != null">
|
||||
airpressure = #{airpressure,jdbcType=NUMERIC},
|
||||
</if>
|
||||
<if test="time != null">
|
||||
time = #{time,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="noise != null">
|
||||
noise = #{noise,jdbcType=NUMERIC},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.aiit.xiuos.model.GZJCData">
|
||||
update haier_data
|
||||
set o3 = #{o3,jdbcType=NUMERIC},
|
||||
co2 = #{co2,jdbcType=NUMERIC},
|
||||
so2 = #{so2,jdbcType=NUMERIC},
|
||||
no2 = #{no2,jdbcType=NUMERIC},
|
||||
nh3 = #{nh3,jdbcType=NUMERIC},
|
||||
tvoc = #{tvoc,jdbcType=NUMERIC},
|
||||
ch2o = #{ch2o,jdbcType=NUMERIC},
|
||||
c2h5oh = #{c2h5oh,jdbcType=NUMERIC},
|
||||
ch4 = #{ch4,jdbcType=NUMERIC},
|
||||
o2 = #{o2,jdbcType=NUMERIC},
|
||||
aqs = #{aqs,jdbcType=NUMERIC},
|
||||
humidness = #{humidness,jdbcType=NUMERIC},
|
||||
temperature = #{temperature,jdbcType=NUMERIC},
|
||||
pm1d0 = #{pm1d0,jdbcType=NUMERIC},
|
||||
pm2d5 = #{pm2d5,jdbcType=NUMERIC},
|
||||
pm10 = #{pm10,jdbcType=NUMERIC},
|
||||
windspeed = #{windspeed,jdbcType=NUMERIC},
|
||||
winddirection = #{winddirection,jdbcType=NUMERIC},
|
||||
airpressure = #{airpressure,jdbcType=NUMERIC},
|
||||
time = #{time,jdbcType=TIMESTAMP},
|
||||
noise = #{noise,jdbcType=NUMERIC}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue