use of com.ganster.cms.core.pojo.Group in project Ganster-CMS by Gangster-trio.
the class UserController method findAllGroup.
/**
* 查找所有的用户组
* @return AjaxData 查找到的信息
*/
@GetMapping("/findgroup")
@ResponseBody
public AjaxData findAllGroup() {
int number = 0;
AjaxData ajaxData = new AjaxData();
GroupExample groupExample = new GroupExample();
groupService.selectByExample(groupExample);
List<Group> groupList = groupService.selectByExample(groupExample);
if (groupList != null && !groupList.isEmpty()) {
ajaxData.setData((ArrayList) groupList);
for (Group i : groupList) {
number++;
}
ajaxData.setCode(number);
return ajaxData;
}
ajaxData.setMsg("查找失败");
return ajaxData;
}
use of com.ganster.cms.core.pojo.Group in project Ganster-CMS by Gangster-trio.
the class UserController method index.
public Boolean index() {
Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute("id");
List<Group> group = groupService.selectByUserId(userId);
for (Group i : group) {
if ("admin".equals(i.getGroupName())) {
return true;
}
}
return false;
}
use of com.ganster.cms.core.pojo.Group in project Ganster-CMS by Gangster-trio.
the class GroupController method deleteGroup.
/**
* 删除用户组
*
* @param groupId 用户组id
*/
@RequestMapping("/delete/{groupId}")
@ResponseBody
public void deleteGroup(@PathVariable("groupId") Integer groupId) {
Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute("id");
List<Group> list = groupService.selectByUserId(userId);
for (Group flag : list) {
if ("admin".equals(flag.getGroupName())) {
groupService.deleteGroup(groupId);
break;
}
}
LOGGER.info("++++++++++++++delete" + groupId + "+++++++++++++++");
PermissionUtil.flush((Integer) SecurityUtils.getSubject().getSession().getAttribute("id"));
}
use of com.ganster.cms.core.pojo.Group in project Ganster-CMS by Gangster-trio.
the class GroupController method addGroup.
/**
* 增加用户组
*
* @param group 用户组
*/
@RequestMapping("/add")
@ResponseBody
public Message addGroup(@RequestBody Group group) {
Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute("id");
List<Group> list = groupService.selectByUserId(userId);
for (Group flag : list) {
if ("admin".equals(flag.getGroupName())) {
int count = groupService.insert(group);
if (count == 0) {
return super.buildMessage(1, "false", null);
}
if (count == 1) {
return super.buildMessage(0, "success", count);
}
break;
}
}
PermissionUtil.flush(userId);
return super.buildMessage(2, "no privilege", null);
}
use of com.ganster.cms.core.pojo.Group in project Ganster-CMS by Gangster-trio.
the class GroupController method updateGroup.
/**
* 更新用户组
*
* @param groupId 用户组id
* @param group 用户组对象
* @return AjaxData
*/
@RequestMapping("/update/{groupId}")
@ResponseBody
public Message updateGroup(@PathVariable("groupId") Integer groupId, @RequestBody Group group) {
Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute("id");
List<Group> list = groupService.selectByUserId(userId);
for (Group flag : list) {
if ("admin".equals(flag.getGroupName())) {
group.setGroupId(groupId);
int count = groupService.updateByPrimaryKeySelective(group);
if (count == 0) {
return super.buildMessage(1, "false", null);
}
if (count == 1) {
return super.buildMessage(0, "success", count);
}
break;
}
}
PermissionUtil.flush(userId);
return super.buildMessage(2, "no privilege", null);
}
Aggregations