org.jeecg.modules.system.model.SysPermissionTree Java Examples

The following examples show how to use org.jeecg.modules.system.model.SysPermissionTree. 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-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 系统菜单列表(一级菜单)
 *
 * @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 #2
Source File: SysPermissionController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 查询子菜单
 * @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 #3
Source File: SysPermissionController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
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: SysPermissionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 系统菜单列表(一级菜单)
 *
 * @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 #5
Source File: SysPermissionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 查询子菜单
 * @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 #6
Source File: SysPermissionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
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 #7
Source File: SysPermissionController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 系统菜单列表(一级菜单)
 *
 * @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 #8
Source File: SysPermissionController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 查询子菜单
 * @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 #9
Source File: SysPermissionController.java    From teaching with Apache License 2.0 6 votes vote down vote up
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 #10
Source File: SysPermissionController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 系统菜单列表(一级菜单)
 *
 * @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 #11
Source File: SysPermissionController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 查询子菜单
 * @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 #12
Source File: SysPermissionController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
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 #13
Source File: SysPermissionController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 查询子菜单
 *
 * @param parentIds 父ID(多个采用半角逗号分割)
 * @return 返回 key-value 的 Map
 */
@GetMapping("/getSystemSubmenuBatch")
public Result getSystemSubmenuBatch(@RequestParam("parentIds") String parentIds) {
	try {
		LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
		List<String> parentIdList = Arrays.asList(parentIds.split(","));
		query.in(SysPermission::getParentId, parentIdList);
		query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
		query.orderByAsc(SysPermission::getSortNo);
		List<SysPermission> list = sysPermissionService.list(query);
		Map<String, List<SysPermissionTree>> listMap = new HashMap<>();
		for (SysPermission item : list) {
			String pid = item.getParentId();
			if (parentIdList.contains(pid)) {
				List<SysPermissionTree> mapList = listMap.get(pid);
				if (mapList == null) {
					mapList = new ArrayList<>();
				}
				mapList.add(new SysPermissionTree(item));
				listMap.put(pid, mapList);
			}
		}
		return Result.ok(listMap);
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		return Result.error("批量查询子菜单失败:" + e.getMessage());
	}
}
 
Example #14
Source File: SysPermissionController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 查询子菜单
 *
 * @param parentIds 父ID(多个采用半角逗号分割)
 * @return 返回 key-value 的 Map
 */
@GetMapping("/getSystemSubmenuBatch")
public Result getSystemSubmenuBatch(@RequestParam("parentIds") String parentIds) {
	try {
		LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
		List<String> parentIdList = Arrays.asList(parentIds.split(","));
		query.in(SysPermission::getParentId, parentIdList);
		query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
		query.orderByAsc(SysPermission::getSortNo);
		List<SysPermission> list = sysPermissionService.list(query);
		Map<String, List<SysPermissionTree>> listMap = new HashMap<>();
		for (SysPermission item : list) {
			String pid = item.getParentId();
			if (parentIdList.contains(pid)) {
				List<SysPermissionTree> mapList = listMap.get(pid);
				if (mapList == null) {
					mapList = new ArrayList<>();
				}
				mapList.add(new SysPermissionTree(item));
				listMap.put(pid, mapList);
			}
		}
		return Result.ok(listMap);
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		return Result.error("批量查询子菜单失败:" + e.getMessage());
	}
}
 
Example #15
Source File: SysPermissionController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 查询子菜单
 *
 * @param parentIds 父ID(多个采用半角逗号分割)
 * @return 返回 key-value 的 Map
 */
@GetMapping("/getSystemSubmenuBatch")
public Result getSystemSubmenuBatch(@RequestParam("parentIds") String parentIds) {
	try {
		LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
		List<String> parentIdList = Arrays.asList(parentIds.split(","));
		query.in(SysPermission::getParentId, parentIdList);
		query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
		query.orderByAsc(SysPermission::getSortNo);
		List<SysPermission> list = sysPermissionService.list(query);
		Map<String, List<SysPermissionTree>> listMap = new HashMap<>();
		for (SysPermission item : list) {
			String pid = item.getParentId();
			if (parentIdList.contains(pid)) {
				List<SysPermissionTree> mapList = listMap.get(pid);
				if (mapList == null) {
					mapList = new ArrayList<>();
				}
				mapList.add(new SysPermissionTree(item));
				listMap.put(pid, mapList);
			}
		}
		return Result.ok(listMap);
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		return Result.error("批量查询子菜单失败:" + e.getMessage());
	}
}