This commit is contained in:
2023-06-21 16:32:13 +08:00
parent 8562600497
commit 2fb4ec8611

View File

@@ -161,6 +161,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
// 清缓存
cleanRedisCache(pileBasicInfo.getSn());
pileBasicInfo.setUpdateTime(DateUtils.getNowDate());
redisCache.deleteObject(CacheConstants.GET_PILE_LIST_BY_STATION_ID + pileBasicInfo.getStationId());
return pileBasicInfoMapper.updatePileBasicInfo(pileBasicInfo);
}
@@ -642,9 +643,14 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
@Override
public List<PileBasicInfo> getPileListByStationId(String stationId) {
String redisKey = CacheConstants.GET_PILE_LIST_BY_STATION_ID + stationId;
List<PileBasicInfo> pileList = pileBasicInfoMapper.getPileListByStationId(stationId);
List<PileBasicInfo> pileList = redisCache.getCacheList(redisKey);
if (CollectionUtils.isEmpty(pileList)) {
pileList = pileBasicInfoMapper.getPileListByStationId(stationId);
if (CollectionUtils.isNotEmpty(pileList)) {
redisCache.setCacheList(redisKey, pileList);
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1d);
}
}
return pileList;
}
}