ParkingLotSharedCache.java
2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.zteits.park.cache;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.clouds.common.cache.base.AbstractCache;
import com.clouds.common.cache.base.HashCacheVO;
import com.clouds.common.constants.RedisKeyEnum;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
import com.zteits.park.domain.TdPParkingShare;
import com.zteits.park.domain.TdPParkingShareExample;
import com.zteits.park.mapper.TdPParkingShareMapper;
/****
*
* Copyright: Copyright (c) 2017 ZTE-ITS
* c
* @ClassName: ParkingLotSharedCache.java
* @Description: 共享车位缓存处理
* @version: v1.0.0
* @author: wangbiao
* @date: 2018年1月12日
* Modification History:
* Date Author Version Description
*---------------------------------------------------------*
* 2018年1月12日 wangbiao v1.0.0 创建
*/
@Component
public class ParkingLotSharedCache extends AbstractCache<HashCacheVO>{
@Autowired
private TdPParkingShareMapper tdPParkingShareMapper;
@Override
protected List<HashCacheVO> getData(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
TdPParkingShareExample example = new TdPParkingShareExample();
example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
List<TdPParkingShare> parkingLots = tdPParkingShareMapper.selectByExample(example );
List<HashCacheVO> cacheVOs = Lists.newArrayList();
for (TdPParkingShare tabParkinglot : parkingLots) {
HashCacheVO vo = new HashCacheVO(tabParkinglot.getPlNo(), tabParkinglot);
cacheVOs.add(vo);
}
return cacheVOs;
}
@Override
protected long getTotalSize() {
TdPParkingShareExample example = new TdPParkingShareExample();
example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
return tdPParkingShareMapper.countByExample(example );
}
@Override
protected String getKey() {
return RedisKeyEnum.PARK_PARKINGLOT_SHARED_PLNO_PARKLOTINFO.key();
}
}