|
@@ -1,83 +0,0 @@
|
|
|
-import com.dgtly.RuoYiApplication;
|
|
|
-import com.dgtly.system.domain.SysMenu;
|
|
|
-import com.dgtly.system.domain.SysUser;
|
|
|
-import com.dgtly.system.service.ISysMenuService;
|
|
|
-import com.dgtly.system.service.ISysModelLayoutService;
|
|
|
-import com.dgtly.system.service.ISysThemeInfoService;
|
|
|
-import javafx.application.Application;
|
|
|
-import org.junit.runner.RunWith;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-import org.springframework.test.context.junit4.SpringRunner;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-@RunWith(SpringRunner.class)
|
|
|
-@SpringBootTest(classes = RuoYiApplication.class)
|
|
|
-public class Test {
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ISysMenuService menuService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ISysModelLayoutService modelLayoutService;
|
|
|
- @Autowired
|
|
|
- private ISysThemeInfoService themeInfoServiceService;
|
|
|
-
|
|
|
-
|
|
|
- @org.junit.Test
|
|
|
- public void testOne(){
|
|
|
- SysUser sysUser = new SysUser();
|
|
|
- sysUser.setUserId(Long.parseLong("1"));
|
|
|
-
|
|
|
- List<Map<String,Object>> rs =getModel(sysUser);
|
|
|
- System.out.println(rs);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public List<Map<String,Object>> getModel(SysUser user) {
|
|
|
- List<Map<String,Object>> rs = new ArrayList<>();
|
|
|
- //根据用户取出 菜单类型为应用的应用
|
|
|
- List<SysMenu> menusApps = menuService.selectMenusAsApp(user);
|
|
|
-
|
|
|
- //根据用户取出磁贴布局信息
|
|
|
- List<Map<String,Object>> models=modelLayoutService.selectModelMenu(user.getUserId());
|
|
|
-
|
|
|
- List<String> removeSysModelIds =new ArrayList<>();
|
|
|
- //便利所有menuMap为A的 菜单。
|
|
|
- for(int n = 0;n<menusApps.size();n++){
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- SysMenu sysMenu = menusApps.get(n);
|
|
|
- map.put("icon",sysMenu.getIcon());
|
|
|
- map.put("menuName",sysMenu.getMenuName());
|
|
|
- map.put("appType",sysMenu.getAppType());
|
|
|
- map.put("target",sysMenu.getTarget());
|
|
|
- map.put("isrefresh",sysMenu.getIsrefresh());
|
|
|
- map.put("url",sysMenu.getUrl());
|
|
|
- map.put("menuId",sysMenu.getMenuId());
|
|
|
- for(int m = 0;m<models.size();m++){
|
|
|
- //如果查询出的磁贴中包含应用的menuid
|
|
|
- if(models.get(m).get("menuId").toString().equals(menusApps.get(n).getMenuId().toString())){
|
|
|
- //将磁贴的相关信息放入
|
|
|
- map.putAll(models.get(m));
|
|
|
- models.remove(m);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- rs.add(map);
|
|
|
- }
|
|
|
- for (Map map :models) {
|
|
|
- removeSysModelIds.add(map.get("menuId").toString());
|
|
|
- }
|
|
|
- //删除多余的磁贴信息;
|
|
|
- if(removeSysModelIds.size()>0){
|
|
|
- modelLayoutService.deleteSMLArray(removeSysModelIds,user.getUserId());
|
|
|
- }
|
|
|
- return rs;
|
|
|
- }
|
|
|
-}
|