package com.zteits.park.cache; import java.util.List; import org.springframework.beans.BeanUtils; 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.dto.park.dto.IrainPknoRelationDTO; import com.zteits.park.domain.IrainPknoRelation; import com.zteits.park.domain.IrainPknoRelationExample; import com.zteits.park.mapper.IrainPknoRelationMapper; /** * 艾润 停车场编号关联关系
* 是要hash类型,hkey为自己停车场编号,value为艾润停车场编号关联表信息 * * Copyright: Copyright (c) 2017 zteits * * @ClassName: ParkingLotAndGeoInfoCache.java * @Description: * @version: v1.0.0 * @author: zhaowg * @date: 2017年6月6日 上午9:58:38 * Modification History: * Date Author Version Description *---------------------------------------------------------* * 2017年6月6日 zhaowg v1.0.0 创建 */ @Component public class IRainPkNoRelationCache extends AbstractCache{ @Autowired private IrainPknoRelationMapper irainPknoRelationMapper; @Override protected List getData(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); IrainPknoRelationExample example = new IrainPknoRelationExample(); List relations = irainPknoRelationMapper.selectByExample(example ); List cacheVOs = Lists.newArrayList(); for (IrainPknoRelation item : relations) { IrainPknoRelationDTO parkingLotDTO = new IrainPknoRelationDTO(); BeanUtils.copyProperties(item, parkingLotDTO); HashCacheVO vo = new HashCacheVO(item.getParkLotpkno(), parkingLotDTO); cacheVOs.add(vo); } return cacheVOs; } @Override protected long getTotalSize() { IrainPknoRelationExample example = new IrainPknoRelationExample(); return irainPknoRelationMapper.countByExample(example ); } @Override protected String getKey() { return RedisKeyEnum.PARK_IRAINPKNORELATION_PLNO_IRAINPKRELATION.key(); } }