package com.yeshi.fanli.service.impl.config;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.stereotype.Service;
|
|
import com.yeshi.fanli.dao.mybatis.SystemConfigMapper;
|
import com.yeshi.fanli.entity.system.BusinessSystem;
|
import com.yeshi.fanli.entity.system.SystemConfig;
|
import com.yeshi.fanli.exception.NotExistObjectException;
|
import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
|
@Service
|
public class SystemConfigServiceImpl implements SystemConfigService{
|
|
@Resource
|
private SystemConfigMapper systemConfigMapper;
|
|
|
@Cacheable(value={"childSystemCache"}, key="#p0")
|
public String get(String sigkey) throws NotExistObjectException {
|
SystemConfig systemConfig = systemConfigMapper.getByKey(sigkey);
|
if(systemConfig == null ){
|
throw new NotExistObjectException("不存在该参数");
|
}
|
return systemConfig.getValue();
|
}
|
|
|
@Cacheable(value={"childSystemCache"}, key="#p0+#system.id")
|
public String get(String key, BusinessSystem system) {
|
if(system==null || system.getId()==0){
|
return "";
|
}
|
SystemConfig systemConfig = systemConfigMapper.getByKeyAndSystemId(key, system.getId());
|
if(systemConfig != null){;
|
return systemConfig.getValue();
|
}
|
return "";
|
}
|
|
|
}
|