refactor: 插件菜单去重处理

This commit is contained in:
wangjiahao 2021-10-13 15:25:23 +08:00
parent df1336241c
commit 7e0d1ecf9f

View File

@ -15,7 +15,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@ -117,8 +119,10 @@ public class DynamicMenuServiceImpl implements DynamicMenuService {
@Transactional
public void syncPluginMenu() {
List<PluginSysMenu> pluginSysMenuList = PluginUtils.pluginMenus();
extPluginSysMenuMapper.deletePluginMenu();
List<PluginSysMenu> pluginSysMenuList = PluginUtils.pluginMenus();
Set<PluginSysMenu> pluginSysMenuSet = new HashSet<>(pluginSysMenuList);
pluginSysMenuList = new ArrayList<>(pluginSysMenuSet);
if(CollectionUtils.isNotEmpty(pluginSysMenuList)){
extPluginSysMenuMapper.savePluginMenu(pluginSysMenuList);
}