fix():修改缓存

dev.saas.ylys
yanchouchou 2024-10-09 16:48:29 +08:00
parent 1468206f1d
commit 5710364aae
5 changed files with 57 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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;
/**
*
*/

View File

@ -55,9 +55,14 @@ public class MessageValueServiceImpl
}
List<MessageValue> list = this.list(queryWrapper);
messageValueCacheService.put(String.valueOf(messageValueReq.getMessageTemplateId()),list);
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

View File

@ -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;
}