Просмотр исходного кода

添加告警对象删除时,同步删除告警对象缓存,告警次数数据

liuyaowen 9 месяцев назад
Родитель
Сommit
fa85e25abe

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotWarncountMapper.java

@@ -59,4 +59,6 @@ public interface IotWarncountMapper {
      * @return 结果
      */
     public int deleteIotWarncountByWctBids(@Param("array") String[] ids, @Param("tid") String tid);
+
+    public int deleteIotWarncountByDevBidAndWcBid(@Param("devBid") String devBid, @Param("wcBid") String wcBid, @Param("tid") String tid);
 }

+ 3 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnconfigServiceImpl.java

@@ -51,6 +51,8 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
     private IotDeviceconfigMapper iotDeviceconfigMapper;
     @Resource
     private RedisCacheManager redisCacheManager;
+    @Resource
+    private IotWarncountMapper iotWarncountMapper;
 
     /**
      * 查询告警配置
@@ -210,6 +212,7 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
         Collection<IotWarnobject> deleteData = CollectionUtils.intersection(oldWarnObjectList,differ);
         for(IotWarnobject iotWarnobject :deleteData){
             iotWarnobjectMapper.deleteIotWarnobjectByWoBid(iotWarnobject.getWoBid(), SecurityUtils.getTid());
+            iotWarncountMapper.deleteIotWarncountByDevBidAndWcBid(iotWarnobject.getDevBid(),iotWarnobject.getWcBid(),SecurityUtils.getTid());
             // 清除告警对象的缓存
             redisCacheManager.deleteObject(RedisCacheKey.IOT_WARN_RE_COUNTS, iotWarnconfigEditReqVo.getWcBid() + ":" + iotWarnobject.getDevBid());
         }

+ 4 - 0
src/main/resources/mapper/IotWarncountMapper.xml

@@ -78,4 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{wctBid}
         </foreach>
     </delete>
+
+    <delete id="deleteIotWarncountByDevBidAndWcBid">
+        delete from IotWarncount where wcBid = #{wcBid} and devBid = #{devBid} and tid = #{tid}
+    </delete>
 </mapper>