mirror of
https://github.com/zfile-dev/zfile.git
synced 2025-04-19 05:34:52 +00:00
🐛 修复存储源别名修改后再修改回去提示占用的 BUG
This commit is contained in:
@@ -129,6 +129,16 @@ public class StorageSourceService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据存储源 key 清除 key 的缓存
|
||||
*
|
||||
* @param storageKey
|
||||
* 存储源 key
|
||||
*/
|
||||
@CacheEvict(key = "#storageKey")
|
||||
public void clearCacheByStorageKey(String storageKey) {}
|
||||
|
||||
|
||||
/**
|
||||
* 根据存储源 key 获取存储源 id
|
||||
*
|
||||
@@ -202,8 +212,8 @@ public class StorageSourceService {
|
||||
public boolean existByStorageKey(String storageKey) {
|
||||
return storageSourceService.findByStorageKey(storageKey) != null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除指定存储源设置, 会级联删除其参数设置
|
||||
*
|
||||
@@ -336,6 +346,11 @@ public class StorageSourceService {
|
||||
if (storageSource.getId() == null) {
|
||||
storageSourceMapper.insert(storageSource);
|
||||
} else {
|
||||
// 判断是否修改了存储源别名,如果修改了则清除之前存储源别名的缓存。
|
||||
StorageSource originStorageSource = storageSourceMapper.selectById(storageSource.getId());
|
||||
if (!StrUtil.equals(originStorageSource.getKey(), storageSource.getKey())) {
|
||||
storageSourceService.clearCacheByStorageKey(originStorageSource.getKey());
|
||||
}
|
||||
storageSourceMapper.updateById(storageSource);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user