Search in sources :

Example 1 with RoleDO

use of io.github.tesla.ops.system.domain.RoleDO in project tesla by linking12.

the class UserController method edit.

@RequiresPermissions("sys:user:edit")
@Log("编辑用户")
@GetMapping("/edit/{id}")
String edit(Model model, @PathVariable("id") Long id) {
    UserDO userDO = userService.get(id);
    model.addAttribute("user", userDO);
    List<RoleDO> roles = roleService.list(id);
    model.addAttribute("roles", roles);
    return prefix + "/edit";
}
Also used : UserDO(io.github.tesla.ops.system.domain.UserDO) RoleDO(io.github.tesla.ops.system.domain.RoleDO) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping) Log(io.github.tesla.ops.common.Log)

Example 2 with RoleDO

use of io.github.tesla.ops.system.domain.RoleDO in project tesla by linking12.

the class RoleServiceImpl method list.

@Override
public List<RoleDO> list(Long userId) {
    List<Long> rolesIds = userRoleMapper.listRoleId(userId);
    List<RoleDO> roles = roleMapper.list(new HashMap<>(16));
    for (RoleDO roleDO : roles) {
        roleDO.setRoleSign("false");
        for (Long roleId : rolesIds) {
            if (Objects.equals(roleDO.getRoleId(), roleId)) {
                roleDO.setRoleSign("true");
                break;
            }
        }
    }
    return roles;
}
Also used : RoleDO(io.github.tesla.ops.system.domain.RoleDO)

Example 3 with RoleDO

use of io.github.tesla.ops.system.domain.RoleDO in project tesla by linking12.

the class RoleController method edit.

@Log("编辑角色")
@RequiresPermissions("sys:role:edit")
@GetMapping("/edit/{id}")
String edit(@PathVariable("id") Long id, Model model) {
    RoleDO roleDO = roleService.get(id);
    model.addAttribute("role", roleDO);
    return prefix + "/edit";
}
Also used : RoleDO(io.github.tesla.ops.system.domain.RoleDO) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping) Log(io.github.tesla.ops.common.Log)

Aggregations

RoleDO (io.github.tesla.ops.system.domain.RoleDO)3 Log (io.github.tesla.ops.common.Log)2 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 UserDO (io.github.tesla.ops.system.domain.UserDO)1