示例#1
0
 /**
  * 更新配置
  *
  * @param key
  * @param value
  */
 @CacheEvict(value = "config")
 public Config updagteConfigByKey(String key, String value) {
   Config config = configDao.getConfigByKey(key);
   config.setValue(value);
   configDao.updateConfig(config);
   this.getStringByKey(key);
   return config;
 }
示例#2
0
 /**
  * 增加配置
  *
  * @param key
  * @param value
  * @return Config
  */
 public Config addConfig(String key, String value) {
   Config config = new Config();
   config.setKey(key);
   config.setValue(value);
   config.setCreateTime(new Date());
   configDao.addConfig(config);
   return config;
 }
示例#3
0
 /**
  * @param key
  * @return
  */
 @Cacheable(value = "config")
 public int getIntKey(String key) {
   Config config = configDao.getConfigByKey(key);
   if (config == null) {
     return 0;
   } else {
     return Integer.parseInt(config.getValue());
   }
 }
示例#4
0
 /**
  * @param key
  * @return
  */
 @Cacheable(value = "config")
 public String getStringByKey(String key) {
   Config config = configDao.getConfigByKey(key);
   if (config == null) {
     return "";
   } else {
     return config.getValue();
   }
 }
示例#5
0
 /**
  * 删除配置
  *
  * @param key
  * @return Integer
  */
 @CacheEvict(value = "config")
 public int deleteConfigByKey(String key) {
   return configDao.deleteConfig(key);
 }