fix bug in alarm rule function

add local and prod yml
This commit is contained in:
wty 2022-11-10 09:43:54 +08:00
parent 8aa4919ea8
commit a0e588751f
19 changed files with 438 additions and 90 deletions

View File

@ -1,4 +1,74 @@
package com.aiit.xiuos.controller; package com.aiit.xiuos.controller;
import com.aiit.xiuos.Utils.Constant;
import com.aiit.xiuos.Utils.ResultRespons;
import com.aiit.xiuos.model.AlarmInfo;
import com.aiit.xiuos.model.AlarmRule;
import com.aiit.xiuos.model.UserInfo;
import com.aiit.xiuos.scheduled.TaskScheduled;
import com.aiit.xiuos.service.AlarmRuleService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/alarmRule")
public class AlarmRuleController { public class AlarmRuleController {
@Autowired
AlarmRuleService alarmRuleService;
@Autowired
TaskScheduled taskScheduled;
@GetMapping("/selectAll")
public ResultRespons getAllInfo(HttpServletRequest request){
UserInfo userInfo =(UserInfo) request.getSession().getAttribute("user");
List<AlarmRule> lists = alarmRuleService.selectAlarmRule(userInfo.getOrg());
if(lists!=null && lists.size()>=0){
return new ResultRespons(Constant.SUCCESS_CODE,"查询告警规则成功!",lists);
}
return new ResultRespons(Constant.ERROR_CODE,"查询告警规则失败!");
}
@PostMapping("/add")
public ResultRespons addRule(@RequestBody AlarmRule alarmRule, HttpServletRequest request){
int res = alarmRuleService.addAlarmRule(alarmRule);
if(res==1){
return new ResultRespons(Constant.SUCCESS_CODE,"新增告警规则成功!");
}
return new ResultRespons(Constant.ERROR_CODE,"新增告警规则失败");
}
@PostMapping("/update")
public ResultRespons updateRule(@RequestBody AlarmRule alarmRule,HttpServletRequest request){
int res = alarmRuleService.updateAlarmRule(alarmRule);
if(res==1){
return new ResultRespons(Constant.SUCCESS_CODE,"更新告警规则成功!");
}
return new ResultRespons(Constant.ERROR_CODE,"更新告警规则失败");
}
@PostMapping("/delete")
public ResultRespons deleteRule(@RequestBody AlarmRule alarmRule,HttpServletRequest request){
int res = alarmRuleService.deleteAlarmRule(alarmRule.getId());
if(res==1){
return new ResultRespons(Constant.SUCCESS_CODE,"删除告警规则成功!");
}
return new ResultRespons(Constant.ERROR_CODE,"删除告警规则失败");
}
@GetMapping("/executeAlarmTask")
public void executeTask(){
try {
taskScheduled.ExecuteRule();
} catch (Exception e) {
e.printStackTrace();
}
}
} }

View File

@ -0,0 +1,4 @@
package com.aiit.xiuos.controller;
public class DataForwardController {
}

View File

@ -1,9 +1,6 @@
package com.aiit.xiuos.controller; package com.aiit.xiuos.controller;
import com.aiit.xiuos.Utils.Constant; import com.aiit.xiuos.Utils.*;
import com.aiit.xiuos.Utils.GenerateIdUtil;
import com.aiit.xiuos.Utils.MyUtils;
import com.aiit.xiuos.Utils.ResultRespons;
import com.aiit.xiuos.model.DeviceInfo; import com.aiit.xiuos.model.DeviceInfo;
import com.aiit.xiuos.model.UserInfo; import com.aiit.xiuos.model.UserInfo;
import com.aiit.xiuos.service.DeviceInfoService; import com.aiit.xiuos.service.DeviceInfoService;
@ -11,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.sql.Connection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -34,11 +32,19 @@ public class DeviceController {
deviceInfo.setId(id); deviceInfo.setId(id);
deviceInfo.setUpdatetime(MyUtils.getTime()); deviceInfo.setUpdatetime(MyUtils.getTime());
deviceInfo.setOrg(userInfo.getOrg()); deviceInfo.setOrg(userInfo.getOrg());
int res=deviceInfoService.addDevice(deviceInfo);
if(1==res){ boolean flag = TDengineJDBCUtil.createTable(deviceInfo.getNo(),deviceInfo.getType(),deviceInfo.getOrg(),deviceInfo.getProductname());
return new ResultRespons(Constant.SUCCESS_CODE,"新增设备成功!");
if(flag) {
int res=deviceInfoService.addDevice(deviceInfo);
if(1==res){
return new ResultRespons(Constant.SUCCESS_CODE,"新增设备成功!");
}else{
return new ResultRespons(Constant.ERROR_CODE,"新增设备失败!");
}
}else{
return new ResultRespons(Constant.ERROR_CODE,"新建设备表失败!");
} }
return new ResultRespons(Constant.ERROR_CODE,"新增设备失败!");
} }
@GetMapping("/select") @GetMapping("/select")
public ResultRespons selectDevice(@RequestParam("activestatus") int activestatus, HttpServletRequest request){ public ResultRespons selectDevice(@RequestParam("activestatus") int activestatus, HttpServletRequest request){

View File

@ -0,0 +1,4 @@
package com.aiit.xiuos.controller;
public class EecludeController {
}

View File

@ -24,7 +24,6 @@ public class LoginController {
if(null!=user){ if(null!=user){
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setAttribute("user",user);//session存用户 session.setAttribute("user",user);//session存用户
System.out.println("session======="+session.getId()); System.out.println("session======="+session.getId());
String ip = MyUtils.getIp(request); String ip = MyUtils.getIp(request);
userInfoService.updateLoginInfo(MyUtils.getTime(),ip,user.getId()); userInfoService.updateLoginInfo(MyUtils.getTime(),ip,user.getId());

View File

@ -24,6 +24,6 @@ public interface AlarmRuleMapper {
@Select("select * from alarm_rule where org =#{org}") @Select("select * from alarm_rule where org =#{org}")
List<AlarmRule> selectAll(@Param("org") String org); List<AlarmRule> selectAll(@Param("org") String org);
@Select("select * from alarm_rule where rule_status = 1") @Select("select * from alarm_rule where rule_status = 1 order by alarm_level")
List<AlarmRule> selectActive(); List<AlarmRule> selectActive();
} }

View File

@ -0,0 +1,17 @@
package com.aiit.xiuos.dao.mappers;
import com.aiit.xiuos.model.DataForwarding;
public interface DataForwardingMapper {
int deleteByPrimaryKey(Integer id);
int insert(DataForwarding record);
int insertSelective(DataForwarding record);
DataForwarding selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(DataForwarding record);
int updateByPrimaryKey(DataForwarding record);
}

View File

@ -39,6 +39,9 @@ public interface DeviceInfoMapper {
@Select("select * from device_info where no=#{no}") @Select("select * from device_info where no=#{no}")
List<DeviceInfo> selectByNo(@Param("no") String no); List<DeviceInfo> selectByNo(@Param("no") String no);
@Select("select type from device_info where no =#{deviceNo}")
List<String> selectTypeByNo(@Param("deviceNo") String deviceNo);
List<Map<String,String>> getDeviceTypeCount(@Param("org") String org); List<Map<String,String>> getDeviceTypeCount(@Param("org") String org);
List<Map<String,String>> getDeviceRunStatusCount(@Param("org") String org); List<Map<String,String>> getDeviceRunStatusCount(@Param("org") String org);

View File

@ -24,7 +24,9 @@ public class AlarmRule {
private String org; private String org;
public AlarmRule(Integer id, String alarmName, Integer alarmLevel, String deviceNo, String alarmSql, Integer ruleStatus, String noticeType, String noticeContent, String org) { private String noticeAddress;
public AlarmRule(Integer id, String alarmName, Integer alarmLevel, String deviceNo, String alarmSql, Integer ruleStatus, String noticeType, String noticeContent, String org, String noticeAddress) {
this.id = id; this.id = id;
this.alarmName = alarmName; this.alarmName = alarmName;
this.alarmLevel = alarmLevel; this.alarmLevel = alarmLevel;
@ -34,6 +36,7 @@ public class AlarmRule {
this.noticeType = noticeType; this.noticeType = noticeType;
this.noticeContent = noticeContent; this.noticeContent = noticeContent;
this.org = org; this.org = org;
this.noticeAddress = noticeAddress;
} }
public AlarmRule() { public AlarmRule() {

View File

@ -0,0 +1,40 @@
package com.aiit.xiuos.model;
import java.util.Date;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class DataForwarding {
private Integer id;
private String topic;
private String content;
private String type;
private Date time;
private String address;
private String org;
private String sql;
public DataForwarding(Integer id, String topic, String content, String type, Date time, String address, String org, String sql) {
this.id = id;
this.topic = topic;
this.content = content;
this.type = type;
this.time = time;
this.address = address;
this.org = org;
this.sql = sql;
}
public DataForwarding() {
super();
}
}

View File

@ -1,11 +1,15 @@
package com.aiit.xiuos.scheduled; package com.aiit.xiuos.scheduled;
import com.aiit.xiuos.Utils.EmailUtil;
import com.aiit.xiuos.Utils.MyUtils; import com.aiit.xiuos.Utils.MyUtils;
import com.aiit.xiuos.model.AvgDayData; import com.aiit.xiuos.Utils.TDengineJDBCUtil;
import com.aiit.xiuos.model.DeviceLogInfo; import com.aiit.xiuos.model.*;
import com.aiit.xiuos.service.AvgDayDataService; import com.aiit.xiuos.service.*;
import com.aiit.xiuos.service.LogInfoService;
import com.aiit.xiuos.service.impl.AvgDayDataServiceImpl; import com.aiit.xiuos.service.impl.AvgDayDataServiceImpl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
@ -19,11 +23,20 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@Component @Component
@Slf4j
public class TaskScheduled { public class TaskScheduled {
@Autowired @Autowired
AvgDayDataService avgDayDataService; AvgDayDataService avgDayDataService;
@Autowired @Autowired
AlarmInfoService alarmInfoService;
@Autowired
AlarmRuleService alarmRuleService;
@Autowired
LogInfoService deviceLogInfoService; LogInfoService deviceLogInfoService;
@Autowired
DeviceInfoService deviceInfoService;
@Autowired
EmailUtil emailUtil;
@Scheduled(cron = "0 0 */1 * * ?")//every hour @Scheduled(cron = "0 0 */1 * * ?")//every hour
public void insertAvgDayData() throws ParseException { public void insertAvgDayData() throws ParseException {
AvgDayData avgDayData =new AvgDayData(); AvgDayData avgDayData =new AvgDayData();
@ -83,34 +96,62 @@ public class TaskScheduled {
} }
// @Scheduled(cron = "0 0 */1 * * ?")//every hour @Scheduled(cron = "0 0 0 * * ?")//every 0:0:0
// public void insertDeviceLog() { public void ExecuteRule() throws Exception {
// String []log={"nsh_main: mmcsd_readsingle: offset=1007095", //查询保存的每一条告警规则
// "nsh_main: imxrt_blocksetup: blocklen=512, total transfer=512 (1 blocks)", List<AlarmRule> alarmRules =alarmRuleService.selectActive();
// " nsh_main: imxrt_sendcmd: cmd: 00000451 arg: 000f5df7 regval: 113a0000 mcrval: 80000011", for(int i=0;i<alarmRules.size();i++){
// "Idle Task: imxrt_interrupt: IRQSTAT: 0000000b IRQSIGEN 107001c2 enabled: 00000002", AlarmRule alarmRule =alarmRules.get(i);
// "nsh_main: mmcsd_read: startsector: 1289408 nsectors: 1 sectorsize: 512", String deviceNo = alarmRule.getDeviceNo();
// "nsh_main: mmcsd_readsingle: startblock=1289408", JSONArray jsonArray = MyUtils.StringToJsonArray(alarmRule.getAlarmSql());
// "nsh_main: imxrt_status: cdstatus=01", String tdString = "select count(*) from " + deviceNo+" where ";
// "nsh_main: mmcsd_readsingle: offset=1289408", //拼接每一条规则
// "nsh_main: imxrt_blocksetup: blocklen=512, total transfer=512 (1 blocks)", for(int j=0;j<jsonArray.size();j++){
// "nsh_main: imxrt_blocksetup: blocklen=512, total transfer=512 (1 blocks)" JSONObject jsonObject = jsonArray.getJSONObject(i);
// }; String param = jsonObject.getString("param");
// Map<String,String> deviceMap = new HashMap<>(); String condition = jsonObject.getString("condition");
// deviceMap.put("A000005","RV400-NPU16T-5G-AR100"); int value =jsonObject.getInteger("value");
// deviceMap.put("A000007","M168-LoRa-FM100"); tdString+=param+condition+value+" and ";
// deviceMap.put("A000008","M528-A800-5G-HM100"); }
// deviceMap.put("A000006","RV400-NPU4T-5G-SR100"); //取前一天数据
// deviceMap.put("A000014","RV400-NPU4T-5G-SR100"); tdString+="ts>now-1d";
// deviceMap.put("A000011","RV400-NPU16T-5G-AR100"); System.out.println("sql+++++++++:"+tdString);
// deviceMap.put("A000063","RV400-4G-FR100"); //去Tdengine执行sql
// deviceMap.put("S01","M168-LoRa-FM100"); int count = TDengineJDBCUtil.getCount(tdString);
// deviceMap.put("S02","M528-A800-5G-HM100"); if(count<=0) {
// deviceMap.put("S06","M528-A800-5G-HM100"); continue;
// deviceMap.put("S12","RV400-NPU16T-5G-AR100"); }else{
// deviceMap.put("S09","RV400-NPU4T-5G-SR100"); AlarmInfo alarmInfo =new AlarmInfo();
// alarmInfo.setDeviceNo(deviceNo);
// } alarmInfo.setAlarmTime(MyUtils.getDateTime());
alarmInfo.setAlarmName(alarmRule.getAlarmName());
String type = deviceInfoService.getTypeByName(deviceNo);
if(null==type) type="未知类型";
alarmInfo.setDeviceType(type);
alarmInfo.setAlarmStatus(1);
alarmInfo.setAlarmLevel(alarmRule.getAlarmLevel());
alarmInfo.setOrg(alarmRule.getOrg());
//保存告警信息告警级别高的插入,低的因主键冲突可自动排除
try{
alarmInfoService.addAlarmInfo(alarmInfo);
}catch (Exception e){
e.printStackTrace();
}
//发送邮件
try{
emailUtil.sendMessage(alarmRule.getNoticeAddress(),"设备告警",alarmRule.getNoticeContent());
log.info("邮件发送成功");
}catch (Exception e) {
log.error("邮件发送失败");
e.printStackTrace();
}
}
}
}
} }

View File

@ -13,4 +13,5 @@ public interface AlarmInfoService {
List<Map<String,String>> getAlarmLevelCount(String org); List<Map<String,String>> getAlarmLevelCount(String org);
//获取未处理得告警数量 //获取未处理得告警数量
int getCount(String org); int getCount(String org);
int addAlarmInfo(AlarmInfo alarmInfo);
} }

View File

@ -0,0 +1,4 @@
package com.aiit.xiuos.service;
public interface DataForward {
}

View File

@ -0,0 +1,4 @@
package com.aiit.xiuos.service.impl;
public class DataForwardServiceImpl {
}

View File

@ -0,0 +1,4 @@
package com.aiit.xiuos.socket;
public class SocketServer {
}

View File

@ -0,0 +1,89 @@
server:
port: 8080
servlet:
session:
timeout: 43200s
spring:
datasource:
nama: xiuosiot
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
username: xiuosiot
password: 123456
hikari:
minimum-idle: 5
maximum-pool-size: 10
idle-timeout: 30000
max-lifetime: 90000
connection-timeout: 30000
connection-test-query: select 'x'
pool-name: xiuosiots
password: 123456
jdbc-url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
# 发送邮件配置
mail:
host: smtp.qq.com # 配置 smtp 服务器地址
port: 587 # smtp 服务器的端口
username: 419034340@qq.com # 配置邮箱用户名(你的邮箱地址)
password: hcoazwtzeofnbidh # 配置申请到的授权码
default-encoding: UTF-8 # 配置邮件编码
properties:
mail:
smtp:
socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂
debug: true
redis:
database: 0
host: 115.238.53.59
port: 6379
password: abc123
jedis:
pool:
max-active: 8
max-wait: 1
max-idle: 10
min-idle: 2
timeout: 6000
config:
activate:
on-profile: local
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
mapper-locations: classpath:mappers/*.xml
#MQTT Config
mqtt:
#MQTT-服务器连接地
hostUrl: tcp://115.238.53.59:1883
#MQTT-连接服务器默认客户端ID
clientId: local-xiuosiot
#MQTT-用户名
username: xiuosiot
#MQTT-密码
password: xiuosiot
#连接超时
timeout: 100
#设置会话心跳时间
keepalive: 100
#默认主题
default-topic: xiuosiot/#
logging:
file:
name: xiuosiot.log

View File

@ -0,0 +1,83 @@
spring:
datasource:
nama: xiuosiot
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
username: xiuosiot
password: 123456
hikari:
minimum-idle: 5
maximum-pool-size: 10
idle-timeout: 30000
max-lifetime: 90000
connection-timeout: 30000
connection-test-query: select 'x'
pool-name: xiuosiots
password: 123456
jdbc-url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
# 发送邮件配置
mail:
host: smtp.qq.com # 配置 smtp 服务器地址
port: 587 # smtp 服务器的端口
username: 419034340@qq.com # 配置邮箱用户名(你的邮箱地址)
password: hcoazwtzeofnbidh # 配置申请到的授权码
default-encoding: UTF-8 # 配置邮件编码
properties:
mail:
smtp:
socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂
debug: true
redis:
database: 0
host: 115.238.53.59
port: 6379
password: abc123
jedis:
pool:
max-active: 8
max-wait: 1
max-idle: 10
min-idle: 2
timeout: 6000
config:
activate:
on-profile: prod
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
mapper-locations: classpath:mappers/*.xml
#MQTT Config
mqtt:
#MQTT-服务器连接地
hostUrl: tcp://115.238.53.59:1883
#MQTT-连接服务器默认客户端ID
clientId: xiuosiot-client
#MQTT-用户名
username: xiuosiot
#MQTT-密码
password: xiuosiot
#连接超时
timeout: 100
#设置会话心跳时间
keepalive: 100
#默认主题
default-topic: xiuosiot/#
logging:
file:
name: xiuosiot.log

View File

@ -4,48 +4,13 @@ server:
session: session:
timeout: 43200s timeout: 43200s
spring: spring:
datasource: profiles:
nama: xiuosiot active: local
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
username: xiuosiot
password: 123456
hikari:
minimum-idle: 5
maximum-pool-size: 10
idle-timeout: 30000
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: select 'x'
pool-name: xiuosiots
password: 123456
jdbc-url: jdbc:postgresql://115.238.53.59:5432/xiuosiot
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
mapper-locations: classpath:mappers/*.xml
#MQTT Config
mqtt:
#MQTT-服务器连接地
hostUrl: tcp://192.168.88.225:1883
#MQTT-连接服务器默认客户端ID
clientId: xiuosiot-client
#MQTT-用户名
username: xiuosiot
#MQTT-密码
password: xiuosiot
#连接超时
timeout: 100
#设置会话心跳时间
keepalive: 100
#默认主题
default-topic: xiuosiot/#
logging:
file:
name: xiuosiot.log

View File

@ -12,11 +12,12 @@
<arg column="notice_type" javaType="java.lang.String" jdbcType="VARCHAR" /> <arg column="notice_type" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="notice_content" javaType="java.lang.String" jdbcType="VARCHAR" /> <arg column="notice_content" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="org" javaType="java.lang.String" jdbcType="VARCHAR" /> <arg column="org" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="notice_address" javaType="java.lang.String" jdbcType="VARCHAR" />
</constructor> </constructor>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, alarm_name, alarm_level, device_no, alarm_sql, rule_status, notice_type, notice_content, id, alarm_name, alarm_level, device_no, alarm_sql, rule_status, notice_type, notice_content,
org org, notice_address
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
@ -31,12 +32,12 @@
<insert id="insert" parameterType="com.aiit.xiuos.model.AlarmRule"> <insert id="insert" parameterType="com.aiit.xiuos.model.AlarmRule">
insert into alarm_rule (id, alarm_name, alarm_level, insert into alarm_rule (id, alarm_name, alarm_level,
device_no, alarm_sql, rule_status, device_no, alarm_sql, rule_status,
notice_type, notice_content, org notice_type, notice_content, org,
) notice_address)
values (#{id,jdbcType=INTEGER}, #{alarmName,jdbcType=VARCHAR}, #{alarmLevel,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{alarmName,jdbcType=VARCHAR}, #{alarmLevel,jdbcType=INTEGER},
#{deviceNo,jdbcType=VARCHAR}, #{alarmSql,jdbcType=VARCHAR}, #{ruleStatus,jdbcType=INTEGER}, #{deviceNo,jdbcType=VARCHAR}, #{alarmSql,jdbcType=VARCHAR}, #{ruleStatus,jdbcType=INTEGER},
#{noticeType,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR}, #{org,jdbcType=VARCHAR} #{noticeType,jdbcType=VARCHAR}, #{noticeContent,jdbcType=VARCHAR}, #{org,jdbcType=VARCHAR},
) #{noticeAddress,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.aiit.xiuos.model.AlarmRule"> <insert id="insertSelective" parameterType="com.aiit.xiuos.model.AlarmRule">
insert into alarm_rule insert into alarm_rule
@ -68,6 +69,9 @@
<if test="org != null"> <if test="org != null">
org, org,
</if> </if>
<if test="noticeAddress != null">
notice_address,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -97,6 +101,9 @@
<if test="org != null"> <if test="org != null">
#{org,jdbcType=VARCHAR}, #{org,jdbcType=VARCHAR},
</if> </if>
<if test="noticeAddress != null">
#{noticeAddress,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.AlarmRule"> <update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.AlarmRule">
@ -126,6 +133,9 @@
<if test="org != null"> <if test="org != null">
org = #{org,jdbcType=VARCHAR}, org = #{org,jdbcType=VARCHAR},
</if> </if>
<if test="noticeAddress != null">
notice_address = #{noticeAddress,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
@ -138,7 +148,8 @@
rule_status = #{ruleStatus,jdbcType=INTEGER}, rule_status = #{ruleStatus,jdbcType=INTEGER},
notice_type = #{noticeType,jdbcType=VARCHAR}, notice_type = #{noticeType,jdbcType=VARCHAR},
notice_content = #{noticeContent,jdbcType=VARCHAR}, notice_content = #{noticeContent,jdbcType=VARCHAR},
org = #{org,jdbcType=VARCHAR} org = #{org,jdbcType=VARCHAR},
notice_address = #{noticeAddress,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
</mapper> </mapper>