use of com.ganster.cms.core.pojo.Permission in project Ganster-CMS by Gangster-trio.
the class GetPermissionUtil method getPermissionName.
public List<String> getPermissionName(String groupName) {
List<String> permissionName = new ArrayList<>();
PInformationUtil pInformationUtil = new PInformationUtil();
GroupExample groupExample = new GroupExample();
logger.info("++++++++++++++++" + groupService);
logger.info("+++++++++++++++++++" + groupName);
groupExample.createCriteria().andGroupNameEqualTo(groupName);
logger.info("++++++++++++++++++++++" + groupExample.toString());
List<Group> groupList = groupService.selectByExample(groupExample);
for (Group group : groupList) {
try {
List<Permission> permissionList = permissionService.selectByGroupId(group.getGroupId());
for (Permission i : permissionList) {
int j = 0;
try {
pInformationUtil.dealInfromation(i.getPermissionName());
String name = "findgroup" + ":" + pInformationUtil.getId();
permissionName.add(name);
j++;
} catch (Exception e) {
break;
}
}
} catch (GroupNotFountException e) {
e.printStackTrace();
}
}
return permissionName;
}
use of com.ganster.cms.core.pojo.Permission in project Ganster-CMS by Gangster-trio.
the class GroupController method getGroupList.
/**
* 用户组的查询(包含权限)
*
* @return AjaxData
*/
@RequestMapping(value = "/find")
@ResponseBody
public AjaxData getGroupList() {
// 查询所有的用户组
GroupExample groupExample = new GroupExample();
List<Group> groupList = groupService.selectByExample(groupExample);
List<GroupWithPermission> gpList = new ArrayList<>();
Set<Permission> permissionList;
for (Group group : groupList) {
permissionList = permissionService.selectByGroupId(group.getGroupId());
List<String> permissionNameList = new ArrayList<>();
if (permissionList != null) {
for (Permission permission : permissionList) {
String permissionNames = permission.getPermissionName();
permissionNameList.add(permissionNames);
}
}
GroupWithPermission groupWithPermission = new GroupWithPermission(group, permissionNameList);
gpList.add(groupWithPermission);
}
/* List permissionNameList = groupList.stream()
.map(group ->
permissionService.selectByGroupId(group.getGroupId()).stream()
.map(Permission::getPermissionName)
).collect(Collectors.toList());
for (Object o:permissionNameList){
System.out.println(o);
}*/
AjaxData ajaxData = new AjaxData();
ajaxData.setMsg("success");
ajaxData.setCount(gpList.size());
ajaxData.setData(gpList);
return ajaxData;
}
Aggregations