提交 5cab34cc 编写于 作者: sq3536's avatar sq3536

config缓存路径识别rt

上级 27641d4a
...@@ -22,12 +22,16 @@ import org.springframework.util.StringUtils; ...@@ -22,12 +22,16 @@ import org.springframework.util.StringUtils;
@Slf4j @Slf4j
@Service @Service
public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> implements IService<IBZConfig> { public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> implements IService<IBZConfig> {
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
<#assign cachename="ibzrt_configs">
<#else >
<#assign cachename=pub.getCodeName()?lower_case+"_configs">
</#if>
@Value("${r'${'}ibiz.systemid:${sys.getName()}}") @Value("${r'${'}ibiz.systemid:${sys.getName()}}")
private String systemId; private String systemId;
@Cacheable( value="ibzou_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @Cacheable( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public JSONObject getConfig(String cfgType,String targetType,String userId) public JSONObject getConfig(String cfgType,String targetType,String userId)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)) if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
...@@ -39,7 +43,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im ...@@ -39,7 +43,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
return JSON.parseObject(config.getCfg()); return JSON.parseObject(config.getCfg());
} }
@CacheEvict( value="ibzou_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @CacheEvict( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public boolean saveConfig(String cfgType,String targetType,String userId,JSONObject config) public boolean saveConfig(String cfgType,String targetType,String userId,JSONObject config)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)) if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
...@@ -50,7 +54,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im ...@@ -50,7 +54,7 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build()); return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build());
} }
@CacheEvict( value="ibzou_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @CacheEvict( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public void resetConfig(String cfgType,String targetType,String userId) public void resetConfig(String cfgType,String targetType,String userId)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)) if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册