org.jeecg.modules.system.entity.SysPermission Java Examples
The following examples show how to use
org.jeecg.modules.system.entity.SysPermission.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 批量删除菜单 * @param ids * @return */ @RequiresRoles({ "admin" }) @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) public Result<SysPermission> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { Result<SysPermission> result = new Result<>(); try { String[] arr = ids.split(","); for (String id : arr) { if (oConvertUtils.isNotEmpty(id)) { sysPermissionService.deletePermission(id); } } result.success("删除成功!"); } catch (Exception e) { log.error(e.getMessage(), e); result.error500("删除成功!"); } return result; }
Example #2
Source File: SysPermissionServiceImpl.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 根据父id删除其关联的子节点数据 * * @return */ public void removeChildrenBy(String parentId) { LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>(); // 封装查询条件parentId为主键, query.eq(SysPermission::getParentId, parentId); // 查出该主键下的所有子级 List<SysPermission> permissionList = this.list(query); if (permissionList != null && permissionList.size() > 0) { String id = ""; // id int num = 0; // 查出的子级数量 // 如果查出的集合不为空, 则先删除所有 this.remove(query); // 再遍历刚才查出的集合, 根据每个对象,查找其是否仍有子级 for (int i = 0, len = permissionList.size(); i < len; i++) { id = permissionList.get(i).getId(); num = this.count(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getParentId, id)); // 如果有, 则递归 if (num > 0) { this.removeChildrenBy(id); } } } }
Example #3
Source File: SysPermissionController.java From teaching with Apache License 2.0 | 6 votes |
private void getTreeList(List<SysPermissionTree> treeList, List<SysPermission> metaList, SysPermissionTree temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); SysPermissionTree tree = new SysPermissionTree(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } } }
Example #4
Source File: SysPermissionServiceImpl.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 逻辑删除 */ @Override @CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true) //@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2") public void deletePermissionLogical(String id) throws JeecgBootException { SysPermission sysPermission = this.getById(id); if(sysPermission==null) { throw new JeecgBootException("未找到菜单信息"); } String pid = sysPermission.getParentId(); int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid)); if(count==1) { //若父节点无其他子节点,则该父节点是叶子节点 this.sysPermissionMapper.setMenuLeaf(pid, 1); } sysPermission.setDelFlag(1); this.updateById(sysPermission); }
Example #5
Source File: SysDepartPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
private void getTreeModelList(List<TreeModel> treeList, List<SysPermission> metaList, TreeModel temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); TreeModel tree = new TreeModel(permission.getId(), tempPid, permission.getName(),permission.getRuleFlag(), permission.isLeaf()); if(temp==null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } }else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){ temp.getChildren().add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } } }
Example #6
Source File: SysRoleController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaList,TreeModel temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); TreeModel tree = new TreeModel(permission.getId(), tempPid, permission.getName(),permission.getRuleFlag(), permission.isLeaf()); if(temp==null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } }else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){ temp.getChildren().add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } } }
Example #7
Source File: SysPermissionController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
private void getTreeList(List<SysPermissionTree> treeList, List<SysPermission> metaList, SysPermissionTree temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); SysPermissionTree tree = new SysPermissionTree(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } } }
Example #8
Source File: SysPermissionDataRuleImpl.java From jeecg-boot-with-activiti with MIT License | 6 votes |
@Override @Transactional public void deletePermissionDataRule(String dataRuleId) { SysPermissionDataRule dataRule = this.baseMapper.selectById(dataRuleId); if(dataRule!=null) { this.removeById(dataRuleId); Integer count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysPermissionDataRule>().eq(SysPermissionDataRule::getPermissionId, dataRule.getPermissionId())); //注:同一个事务中删除后再查询是会认为数据已被删除的 若事务回滚上述删除无效 if(count==null || count==0) { SysPermission permission = sysPermissionMapper.selectById(dataRule.getPermissionId()); if(permission!=null && permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_1)) { permission.setRuleFlag(CommonConstant.RULE_FLAG_0); sysPermissionMapper.updateById(permission); } } } }
Example #9
Source File: SysPermissionController.java From teaching with Apache License 2.0 | 6 votes |
/** * 系统菜单列表(一级菜单) * * @return */ @RequestMapping(value = "/getSystemMenuList", method = RequestMethod.GET) public Result<List<SysPermissionTree>> getSystemMenuList() { long start = System.currentTimeMillis(); Result<List<SysPermissionTree>> result = new Result<>(); try { LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getMenuType,CommonConstant.MENU_TYPE_0); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.orderByAsc(SysPermission::getSortNo); List<SysPermission> list = sysPermissionService.list(query); List<SysPermissionTree> sysPermissionTreeList = new ArrayList<SysPermissionTree>(); for(SysPermission sysPermission : list){ SysPermissionTree sysPermissionTree = new SysPermissionTree(sysPermission); sysPermissionTreeList.add(sysPermissionTree); } result.setResult(sysPermissionTreeList); result.setSuccess(true); } catch (Exception e) { log.error(e.getMessage(), e); } log.info("======获取一级菜单数据=====耗时:" + (System.currentTimeMillis() - start) + "毫秒"); return result; }
Example #10
Source File: SysPermissionController.java From teaching with Apache License 2.0 | 6 votes |
private void getTreeModelList(List<TreeModel> treeList, List<SysPermission> metaList, TreeModel temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); TreeModel tree = new TreeModel(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getKey())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } } }
Example #11
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
private void getTreeModelList(List<TreeModel> treeList, List<SysPermission> metaList, TreeModel temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); TreeModel tree = new TreeModel(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getKey())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } } }
Example #12
Source File: SysPermissionServiceImpl.java From jeecg-boot with Apache License 2.0 | 6 votes |
@Override @CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true) public void addPermission(SysPermission sysPermission) throws JeecgBootException { //---------------------------------------------------------------------- //判断是否是一级菜单,是的话清空父菜单 if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) { sysPermission.setParentId(null); } //---------------------------------------------------------------------- String pid = sysPermission.getParentId(); if(oConvertUtils.isNotEmpty(pid)) { //设置父节点不为叶子节点 this.sysPermissionMapper.setMenuLeaf(pid, 0); } sysPermission.setCreateTime(new Date()); sysPermission.setDelFlag(0); sysPermission.setLeaf(true); this.save(sysPermission); }
Example #13
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
private void getTreeList(List<SysPermissionTree> treeList, List<SysPermission> metaList, SysPermissionTree temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); SysPermissionTree tree = new SysPermissionTree(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } } }
Example #14
Source File: SysPermissionServiceImpl.java From teaching with Apache License 2.0 | 6 votes |
/** * 根据父id删除其关联的子节点数据 * * @return */ public void removeChildrenBy(String parentId) { LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>(); // 封装查询条件parentId为主键, query.eq(SysPermission::getParentId, parentId); // 查出该主键下的所有子级 List<SysPermission> permissionList = this.list(query); if (permissionList != null && permissionList.size() > 0) { String id = ""; // id int num = 0; // 查出的子级数量 // 如果查出的集合不为空, 则先删除所有 this.remove(query); // 再遍历刚才查出的集合, 根据每个对象,查找其是否仍有子级 for (int i = 0, len = permissionList.size(); i < len; i++) { id = permissionList.get(i).getId(); num = this.count(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getParentId, id)); // 如果有, 则递归 if (num > 0) { this.removeChildrenBy(id); } } } }
Example #15
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 系统菜单列表(一级菜单) * * @return */ @RequestMapping(value = "/getSystemMenuList", method = RequestMethod.GET) public Result<List<SysPermissionTree>> getSystemMenuList() { long start = System.currentTimeMillis(); Result<List<SysPermissionTree>> result = new Result<>(); try { LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getMenuType,CommonConstant.MENU_TYPE_0); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.orderByAsc(SysPermission::getSortNo); List<SysPermission> list = sysPermissionService.list(query); List<SysPermissionTree> sysPermissionTreeList = new ArrayList<SysPermissionTree>(); for(SysPermission sysPermission : list){ SysPermissionTree sysPermissionTree = new SysPermissionTree(sysPermission); sysPermissionTreeList.add(sysPermissionTree); } result.setResult(sysPermissionTreeList); result.setSuccess(true); } catch (Exception e) { log.error(e.getMessage(), e); } log.info("======获取一级菜单数据=====耗时:" + (System.currentTimeMillis() - start) + "毫秒"); return result; }
Example #16
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
private void getTreeList(List<SysPermissionTree> treeList, List<SysPermission> metaList, SysPermissionTree temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); SysPermissionTree tree = new SysPermissionTree(permission); if (temp == null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) { temp.getChildren().add(tree); if (!tree.getIsLeaf()) { getTreeList(treeList, metaList, tree); } } } }
Example #17
Source File: SysPermissionDataRuleImpl.java From jeecg-cloud with Apache License 2.0 | 6 votes |
@Override @Transactional public void deletePermissionDataRule(String dataRuleId) { SysPermissionDataRule dataRule = this.baseMapper.selectById(dataRuleId); if(dataRule!=null) { this.removeById(dataRuleId); Integer count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysPermissionDataRule>().eq(SysPermissionDataRule::getPermissionId, dataRule.getPermissionId())); //注:同一个事务中删除后再查询是会认为数据已被删除的 若事务回滚上述删除无效 if(count==null || count==0) { SysPermission permission = sysPermissionMapper.selectById(dataRule.getPermissionId()); if(permission!=null && permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_1)) { permission.setRuleFlag(CommonConstant.RULE_FLAG_0); sysPermissionMapper.updateById(permission); } } } }
Example #18
Source File: SysPermissionServiceImpl.java From teaching with Apache License 2.0 | 6 votes |
@Override @CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true) public void addPermission(SysPermission sysPermission) throws JeecgBootException { //---------------------------------------------------------------------- //判断是否是一级菜单,是的话清空父菜单 if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) { sysPermission.setParentId(null); } //---------------------------------------------------------------------- String pid = sysPermission.getParentId(); if(oConvertUtils.isNotEmpty(pid)) { //设置父节点不为叶子节点 this.sysPermissionMapper.setMenuLeaf(pid, 0); } sysPermission.setCreateTime(new Date()); sysPermission.setDelFlag(0); sysPermission.setLeaf(true); this.save(sysPermission); }
Example #19
Source File: SysRoleController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 用户角色授权功能,查询菜单权限树 * @param request * @return */ @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET) public Result<Map<String,Object>> queryTreeList(HttpServletRequest request) { Result<Map<String,Object>> result = new Result<>(); //全部权限ids List<String> ids = new ArrayList<>(); try { LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.orderByAsc(SysPermission::getSortNo); List<SysPermission> list = sysPermissionService.list(query); for(SysPermission sysPer : list) { ids.add(sysPer.getId()); } List<TreeModel> treeList = new ArrayList<>(); getTreeModelList(treeList, list, null); Map<String,Object> resMap = new HashMap<String,Object>(); resMap.put("treeList", treeList); //全部树节点数据 resMap.put("ids", ids);//全部树ids result.setResult(resMap); result.setSuccess(true); } catch (Exception e) { log.error(e.getMessage(), e); } return result; }
Example #20
Source File: SysRoleController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaList,TreeModel temp) { for (SysPermission permission : metaList) { String tempPid = permission.getParentId(); TreeModel tree = new TreeModel(permission.getId(), tempPid, permission.getName(),permission.getRuleFlag(), permission.isLeaf()); if(temp==null && oConvertUtils.isEmpty(tempPid)) { treeList.add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } }else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){ temp.getChildren().add(tree); if(!tree.getIsLeaf()) { getTreeModelList(treeList, metaList, tree); } } } }
Example #21
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 查询子菜单 * @param parentId * @return */ @RequestMapping(value = "/getSystemSubmenu", method = RequestMethod.GET) public Result<List<SysPermissionTree>> getSystemSubmenu(@RequestParam("parentId") String parentId){ Result<List<SysPermissionTree>> result = new Result<>(); try{ LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getParentId,parentId); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.orderByAsc(SysPermission::getSortNo); List<SysPermission> list = sysPermissionService.list(query); List<SysPermissionTree> sysPermissionTreeList = new ArrayList<SysPermissionTree>(); for(SysPermission sysPermission : list){ SysPermissionTree sysPermissionTree = new SysPermissionTree(sysPermission); sysPermissionTreeList.add(sysPermissionTree); } result.setResult(sysPermissionTreeList); result.setSuccess(true); }catch (Exception e){ log.error(e.getMessage(), e); } return result; }
Example #22
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 查询子菜单 * @param parentId * @return */ @RequestMapping(value = "/getSystemSubmenu", method = RequestMethod.GET) public Result<List<SysPermissionTree>> getSystemSubmenu(@RequestParam("parentId") String parentId){ Result<List<SysPermissionTree>> result = new Result<>(); try{ LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getParentId,parentId); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.orderByAsc(SysPermission::getSortNo); List<SysPermission> list = sysPermissionService.list(query); List<SysPermissionTree> sysPermissionTreeList = new ArrayList<SysPermissionTree>(); for(SysPermission sysPermission : list){ SysPermissionTree sysPermissionTree = new SysPermissionTree(sysPermission); sysPermissionTreeList.add(sysPermissionTree); } result.setResult(sysPermissionTreeList); result.setSuccess(true); }catch (Exception e){ log.error(e.getMessage(), e); } return result; }
Example #23
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 查询用户拥有的菜单权限和按钮权限(根据TOKEN) * * @return */ @RequestMapping(value = "/getUserPermissionByToken", method = RequestMethod.GET) public Result<?> getUserPermissionByToken(@RequestParam(name = "token", required = true) String token) { Result<JSONObject> result = new Result<JSONObject>(); try { if (oConvertUtils.isEmpty(token)) { return Result.error("TOKEN不允许为空!"); } log.info(" ------ 通过令牌获取用户拥有的访问菜单 ---- TOKEN ------ " + token); String username = JwtUtil.getUsername(token); List<SysPermission> metaList = sysPermissionService.queryByUser(username); PermissionDataUtil.addIndexPage(metaList); JSONObject json = new JSONObject(); JSONArray menujsonArray = new JSONArray(); this.getPermissionJsonArray(menujsonArray, metaList, null); JSONArray authjsonArray = new JSONArray(); this.getAuthJsonArray(authjsonArray, metaList); //查询所有的权限 LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.eq(SysPermission::getMenuType, CommonConstant.MENU_TYPE_2); //query.eq(SysPermission::getStatus, "1"); List<SysPermission> allAuthList = sysPermissionService.list(query); JSONArray allauthjsonArray = new JSONArray(); this.getAllAuthJsonArray(allauthjsonArray, allAuthList); json.put("menu", menujsonArray); json.put("auth", authjsonArray); json.put("allAuth", allauthjsonArray); result.setResult(json); result.success("查询成功"); } catch (Exception e) { result.error500("查询失败:" + e.getMessage()); log.error(e.getMessage(), e); } return result; }
Example #24
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 编辑菜单 * @param permission * @return */ @RequiresRoles({ "admin" }) @RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST }) public Result<SysPermission> edit(@RequestBody SysPermission permission) { Result<SysPermission> result = new Result<>(); try { permission = PermissionDataUtil.intelligentProcessData(permission); sysPermissionService.editPermission(permission); result.success("修改成功!"); } catch (Exception e) { log.error(e.getMessage(), e); result.error500("操作失败"); } return result; }
Example #25
Source File: PermissionDataUtil.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 如果没有index页面 需要new 一个放到list中 * @param metaList */ public static void addIndexPage(List<SysPermission> metaList) { boolean hasIndexMenu = false; for (SysPermission sysPermission : metaList) { if("首页".equals(sysPermission.getName())) { hasIndexMenu = true; break; } } if(!hasIndexMenu) { metaList.add(0,new SysPermission(true)); } }
Example #26
Source File: SysPermissionDataRuleImpl.java From jeecg-boot with Apache License 2.0 | 5 votes |
@Override @Transactional public void savePermissionDataRule(SysPermissionDataRule sysPermissionDataRule) { this.save(sysPermissionDataRule); SysPermission permission = sysPermissionMapper.selectById(sysPermissionDataRule.getPermissionId()); if(permission!=null && (permission.getRuleFlag()==null || permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_0))) { permission.setRuleFlag(CommonConstant.RULE_FLAG_1); sysPermissionMapper.updateById(permission); } }
Example #27
Source File: NgAlainServiceImpl.java From teaching with Apache License 2.0 | 5 votes |
@Override public JSONArray getJeecgMenu(String id) throws Exception { List<SysPermission> metaList = sysPermissionService.queryByUser(id); JSONArray jsonArray = new JSONArray(); getPermissionJsonArray(jsonArray, metaList, null); JSONArray menulist= parseNgAlain(jsonArray); JSONObject jeecgMenu = new JSONObject(); jeecgMenu.put("text", "jeecg菜单"); jeecgMenu.put("group",true); jeecgMenu.put("children", menulist); JSONArray jeecgMenuList=new JSONArray(); jeecgMenuList.add(jeecgMenu); return jeecgMenuList; }
Example #28
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 添加菜单 * @param permission * @return */ //@RequiresRoles({"admin"}) @RequestMapping(value = "/add", method = RequestMethod.POST) public Result<SysPermission> add(@RequestBody SysPermission permission) { Result<SysPermission> result = new Result<SysPermission>(); try { permission = PermissionDataUtil.intelligentProcessData(permission); sysPermissionService.addPermission(permission); result.success("添加成功!"); } catch (Exception e) { log.error(e.getMessage(), e); result.error500("操作失败"); } return result; }
Example #29
Source File: PermissionDataUtil.java From teaching with Apache License 2.0 | 5 votes |
/** * 判断是否授权首页 * @param metaList * @return */ public static boolean hasIndexPage(List<SysPermission> metaList){ boolean hasIndexMenu = false; for (SysPermission sysPermission : metaList) { if("首页".equals(sysPermission.getName())) { hasIndexMenu = true; break; } } return hasIndexMenu; }
Example #30
Source File: TreeModel.java From jeecg-cloud with Apache License 2.0 | 5 votes |
public TreeModel(SysPermission permission) { this.key = permission.getId(); this.icon = permission.getIcon(); this.parentId = permission.getParentId(); this.title = permission.getName(); this.slotTitle = permission.getName(); this.value = permission.getId(); this.isLeaf = permission.isLeaf(); this.label = permission.getName(); if(!permission.isLeaf()) { this.children = new ArrayList<TreeModel>(); } }