feat: 处理缓存null的报错

This commit is contained in:
钟喜旺 2024-08-02 15:46:23 +08:00
parent 1931ffda88
commit e727ab26ca
3 changed files with 20 additions and 3 deletions

View File

@ -113,7 +113,6 @@ public class KpiAreaService : ApplicationService
await _ruleAreaRepository.UpdateAreaInfoAsync(ruleAreaEntity);
await _forewarningCacheService.ClearRedisByAreaId(areaInfo.AreaId);
await RedisHelper.Client.PublishAsync(GlobalConst.PublishNotifyChannelKey, "clear local cache");
return new UnifyResultDto(true, "更新成功");
}

View File

@ -1,3 +1,17 @@
namespace SJZY.Track.Domain.Dtos.Forewarning;
public record RuleAreaBaseInfo(int SystemId, int CustomerId);
public class RuleAreaBaseInfo
{
public int SystemId { get; set; }
public int CustomerId { get; set; }
public RuleAreaBaseInfo()
{
}
public RuleAreaBaseInfo(int systemId, int customerId)
{
SystemId = systemId;
CustomerId = customerId;
}
}

View File

@ -60,7 +60,11 @@ public class WarningQueries : ISugarRepository, IWarningQueries,
return Context.Queryable<WarningRuleEntity>()
.InnerJoin<WarningEntity>((a, b) => a.WarningId == b.Id)
.Where((a, b) => b.IsEnable && a.AreaId == areaId)
.Select((a, b) => new RuleAreaBaseInfo(b.CustomerId, b.SubSystemId))
.Select((a, b) => new RuleAreaBaseInfo
{
CustomerId = b.CustomerId,
SystemId = b.SubSystemId
})
.ToListAsync();
}
}