fix():修改缓存
parent
1468206f1d
commit
5710364aae
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBasic;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.SysCarType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 车辆类型缓存服务
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/9/30 11:18
|
||||
* @注释
|
||||
*/
|
||||
@Component
|
||||
public class CarFenceCacheService extends CacheAbsBasic<String, CarFence> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "sysCarType:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encode(String key) {
|
||||
return super.encode(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return super.decode(key);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import com.muyu.domain.SysCarType;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 车型缓存服务
|
||||
* 车辆类型缓存服务
|
||||
* @version 1.0
|
||||
* @Author xie ya ru
|
||||
* @Date 2024/9/30 11:18
|
||||
|
|
|
@ -13,10 +13,12 @@ import com.muyu.enterpise.mapper.CarFenceMapper;
|
|||
import com.muyu.enterpise.service.CarFenceClazzService;
|
||||
import com.muyu.enterpise.service.CarFenceService;
|
||||
import com.muyu.enterpise.service.CarFenceTypeService;
|
||||
import com.muyu.enterprise.cache.CarFenceCacheService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -37,6 +39,8 @@ public class CarFenceServiceImpl
|
|||
private CarFenceClazzService carFenceClazzService;
|
||||
@Autowired
|
||||
private CarFenceTypeService carFenceTypeService;
|
||||
@Resource
|
||||
private CarFenceCacheService carFenceCacheService;
|
||||
/**
|
||||
* 查询围栏信息
|
||||
*/
|
||||
|
|
|
@ -55,9 +55,14 @@ public class MessageValueServiceImpl
|
|||
}
|
||||
|
||||
List<MessageValue> list = this.list(queryWrapper);
|
||||
messageValueCacheService.put(String.valueOf(messageValueReq.getMessageTemplateId()),list);
|
||||
List<MessageValue> messageValues = messageValueCacheService.get(String.valueOf(messageValueReq.getMessageTemplateId()));
|
||||
System.out.println("asoldonasond:"+messageValues);
|
||||
for (MessageValue messageValue : list) {
|
||||
Long messageId = messageValue.getMessageId();
|
||||
messageValueCacheService.put(String.valueOf(messageId),list);
|
||||
List<MessageValue> messageValues = messageValueCacheService.get(String.valueOf(messageValueReq.getMessageTemplateId()));
|
||||
System.out.println("asoldonasond:"+messageValues);
|
||||
}
|
||||
|
||||
|
||||
return list.stream()
|
||||
.map(messageValue -> MessageValueListResp.valueBuild(
|
||||
messageValue
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.domain.SysCarType;
|
||||
import com.muyu.enterpise.mapper.SysTypeMapper;
|
||||
import com.muyu.enterpise.service.SysTypeService;
|
||||
import com.muyu.enterprise.cache.SysCarTypeCacheService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -23,6 +24,8 @@ public class SysTypeServiceImpl
|
|||
|
||||
@Resource
|
||||
private SysTypeMapper sysTypeMapper;
|
||||
@Resource
|
||||
private SysCarTypeCacheService sysCarTypeCacheService;
|
||||
|
||||
/**
|
||||
* 查询车辆类型列表
|
||||
|
@ -30,7 +33,16 @@ public class SysTypeServiceImpl
|
|||
*/
|
||||
@Override
|
||||
public List<SysCarType> selectSysTypeList() {
|
||||
return sysTypeMapper.selectSysList();
|
||||
List<SysCarType> sysCarTypes = sysTypeMapper.selectSysList();
|
||||
|
||||
for (SysCarType sysCarType : sysCarTypes) {
|
||||
String id = sysCarType.getId();
|
||||
sysCarTypeCacheService.put(id,sysCarType);
|
||||
SysCarType sysCarType1 = sysCarTypeCacheService.get(id);
|
||||
System.out.println(sysCarType1);
|
||||
}
|
||||
|
||||
return sysCarTypes;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue