|
|
@ -17,9 +17,17 @@ |
|
|
|
|
|
|
|
package com.epmet.redis; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.dao.IcHouseDao; |
|
|
|
import com.epmet.dto.result.HouseInfoDTO; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 房屋信息 |
|
|
@ -32,6 +40,9 @@ public class IcHouseRedis { |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IcHouseDao icHouseDao; |
|
|
|
|
|
|
|
public void delete(Object[] ids) { |
|
|
|
|
|
|
|
} |
|
|
@ -44,4 +55,28 @@ public class IcHouseRedis { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 往缓存放房屋信息 |
|
|
|
* @param houseId |
|
|
|
* @param map |
|
|
|
* @author zxc |
|
|
|
* @date 2022/1/18 3:55 下午 |
|
|
|
*/ |
|
|
|
public void setHouseInfo(String houseId, Map<String, Object> map){ |
|
|
|
String key = RedisKeys.getHouseInfoCacheKey(houseId); |
|
|
|
redisUtils.hMSet(key, map); |
|
|
|
} |
|
|
|
|
|
|
|
public HouseInfoDTO getHouseInfo(String houseId){ |
|
|
|
String key = RedisKeys.getHouseInfoCacheKey(houseId); |
|
|
|
Map<String, Object> map = redisUtils.hGetAll(key); |
|
|
|
if (!CollectionUtils.isEmpty(map)){ |
|
|
|
return ConvertUtils.mapToEntity(map,HouseInfoDTO.class); |
|
|
|
} |
|
|
|
HouseInfoDTO houseInfo = icHouseDao.queryHouseInfoByHouseId(houseId); |
|
|
|
Map<String, Object> result = BeanUtil.beanToMap(houseInfo, false, true); |
|
|
|
setHouseInfo(houseId,result); |
|
|
|
return houseInfo; |
|
|
|
} |
|
|
|
|
|
|
|
} |