fix: 新开发的数据源插件替换时,存在使用中的数据源数据集则无法更新
This commit is contained in:
parent
6cdf45fc27
commit
5275c28bd3
@ -58,7 +58,7 @@ public class SysPluginController {
|
||||
@RequiresPermissions("plugin:upload")
|
||||
public Map<String, Object> update(@PathVariable("pluginId") Long pluginId, @RequestParam("file") MultipartFile file) throws Exception {
|
||||
DeFileUtils.validateFile(file);
|
||||
if (pluginService.uninstall(pluginId)) {
|
||||
if (pluginService.uninstallForUpdate(pluginId, true)) {
|
||||
return pluginService.localInstall(file);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -221,6 +221,10 @@ public class PluginService {
|
||||
* @return
|
||||
*/
|
||||
public Boolean uninstall(Long pluginId) {
|
||||
return uninstallForUpdate(pluginId, false);
|
||||
}
|
||||
|
||||
public Boolean uninstallForUpdate(Long pluginId, boolean forUpdate) {
|
||||
MyPlugin myPlugin = myPluginMapper.selectByPrimaryKey(pluginId);
|
||||
if (ObjectUtils.isEmpty(myPlugin)) {
|
||||
String msg = "当前插件不存在";
|
||||
@ -232,7 +236,7 @@ public class PluginService {
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
|
||||
if (myPlugin.getCategory().equalsIgnoreCase("datasource")) {
|
||||
if (myPlugin.getCategory().equalsIgnoreCase("datasource") && !forUpdate) {
|
||||
if (CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))) {
|
||||
DEException.throwException(Translator.get("i18n_plugin_not_allow_delete"));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user