Search in sources :

Example 1 with SysRolePermission

use of com.megagao.production.ssm.domain.authority.SysRolePermission in project production_ssm by megagao.

the class PermissionServiceImpl method updateByRoleId.

@Override
public CustomResult updateByRoleId(String roleId, String permission) throws Exception {
    SysRolePermission sysRolePermission = new SysRolePermission();
    sysRolePermission.setSysPermissionId(permission);
    sysRolePermission.setSysRoleId(roleId);
    // 修改角色权限表
    int i = sysRolePermissionMapper.updateRolePermission(sysRolePermission);
    if (i > 0) {
        return CustomResult.ok();
    } else {
        return null;
    }
}
Also used : SysRolePermission(com.megagao.production.ssm.domain.authority.SysRolePermission)

Example 2 with SysRolePermission

use of com.megagao.production.ssm.domain.authority.SysRolePermission in project production_ssm by megagao.

the class PermissionServiceImpl method getList.

@Override
public EUDataGridResult getList(int page, int rows, SysRolePermission sysRolePermission) throws Exception {
    // 查询列表
    SysRolePermissionExample example = new SysRolePermissionExample();
    // 分页处理
    PageHelper.startPage(page, rows);
    List<SysRolePermission> list = sysRolePermissionMapper.selectByExample(example);
    // 创建一个返回值对象
    EUDataGridResult result = new EUDataGridResult();
    result.setRows(list);
    // 取记录总条数
    PageInfo<SysRolePermission> pageInfo = new PageInfo<>(list);
    result.setTotal(pageInfo.getTotal());
    return result;
}
Also used : SysRolePermission(com.megagao.production.ssm.domain.authority.SysRolePermission) PageInfo(com.github.pagehelper.PageInfo) EUDataGridResult(com.megagao.production.ssm.domain.customize.EUDataGridResult) SysRolePermissionExample(com.megagao.production.ssm.domain.authority.SysRolePermissionExample)

Example 3 with SysRolePermission

use of com.megagao.production.ssm.domain.authority.SysRolePermission in project production_ssm by megagao.

the class RoleServiceImpl method updateAll.

@Override
public CustomResult updateAll(SysRole role) throws Exception {
    // 在业务层整合处理
    SysRolePermission sysRolePermission = new SysRolePermission();
    sysRolePermission.setSysRoleId(role.getRoleId());
    sysRolePermission.setSysPermissionId(role.getPermission());
    // 修改角色权限表
    int k = sysRolePermissionMapper.updateRolePermission(sysRolePermission);
    int i = sysRoleMapper.updateByPrimaryKey(role);
    if (i > 0 && k > 0) {
        return CustomResult.ok();
    } else {
        return CustomResult.build(101, "修改角色信息失败");
    }
}
Also used : SysRolePermission(com.megagao.production.ssm.domain.authority.SysRolePermission)

Example 4 with SysRolePermission

use of com.megagao.production.ssm.domain.authority.SysRolePermission in project production_ssm by megagao.

the class RoleServiceImpl method insert.

@Override
public CustomResult insert(SysRole role) throws Exception {
    // 在业务层整合
    SysRolePermission sysRolePermission = new SysRolePermission();
    sysRolePermission.setId(IDUtils.genStringId());
    sysRolePermission.setSysRoleId(role.getRoleId());
    sysRolePermission.setSysPermissionId(role.getPermission());
    // 存角色权限表
    int k = sysRolePermissionMapper.insertSelective(sysRolePermission);
    int i = sysRoleMapper.insert(role);
    if (i > 0 && k > 0) {
        return CustomResult.ok();
    } else {
        return CustomResult.build(101, "新增角色信息失败");
    }
}
Also used : SysRolePermission(com.megagao.production.ssm.domain.authority.SysRolePermission)

Aggregations

SysRolePermission (com.megagao.production.ssm.domain.authority.SysRolePermission)4 PageInfo (com.github.pagehelper.PageInfo)1 SysRolePermissionExample (com.megagao.production.ssm.domain.authority.SysRolePermissionExample)1 EUDataGridResult (com.megagao.production.ssm.domain.customize.EUDataGridResult)1