|  |  |  | 
|---|
|  |  |  | package com.moral.api.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.moral.api.entity.OrganizationUnitAlarm; | 
|---|
|  |  |  | import com.moral.api.mapper.OrganizationUnitAlarmMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | //查询更新前的记录用于插入日志 | 
|---|
|  |  |  | OrganizationUnitAlarm oldRecord = organizationUnitAlarmMapper.selectById(organizationUnitAlarm.getId()); | 
|---|
|  |  |  | //更新 | 
|---|
|  |  |  | organizationUnitAlarmMapper.updateById(organizationUnitAlarm); | 
|---|
|  |  |  | UpdateWrapper updateWrapper = new UpdateWrapper(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(organizationUnitAlarm.getAlarmLevel().equals("[]")) | 
|---|
|  |  |  | updateWrapper.set("alarm_level",null); | 
|---|
|  |  |  | else | 
|---|
|  |  |  | updateWrapper.set("alarm_level",organizationUnitAlarm.getAlarmLevel()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(organizationUnitAlarm.getShowUnitKey()!=null) | 
|---|
|  |  |  | updateWrapper.set("show_unit_key",organizationUnitAlarm.getShowUnitKey()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | updateWrapper.eq("id",organizationUnitAlarm.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | organizationUnitAlarmMapper.update(null,updateWrapper); | 
|---|
|  |  |  | //获取更新后的记录用于插入日志 | 
|---|
|  |  |  | OrganizationUnitAlarm newRecord = organizationUnitAlarmMapper.selectById(organizationUnitAlarm.getId()); | 
|---|
|  |  |  | //刷新deviceInfo缓存 | 
|---|
|  |  |  | CacheUtils.flushDeviceAlarmInfo(); | 
|---|
|  |  |  | CacheUtils.refreshDeviceAlarmInfo(); | 
|---|
|  |  |  | CacheUtils.refreshSpecialDeviceAlarmInfo(); | 
|---|
|  |  |  | //封装返回对象 | 
|---|
|  |  |  | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); | 
|---|
|  |  |  | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); | 
|---|