rebuildRoleAreaScope

This commit is contained in:
sxu 2025-03-12 09:25:08 +08:00
parent 77381543b7
commit e81c17a318
3 changed files with 30 additions and 5 deletions

View File

@ -164,7 +164,7 @@ public class SysRoleController extends BaseController
*/
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
@PostMapping("/roleArea/edit")
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理",details = "修改权限")
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理->区域权限",details = "修改权限")
public AjaxResult rebuildRoleAreaScope(@RequestBody SysRole role) {
try{
roleService.checkRoleAllowed(role);
@ -176,6 +176,23 @@ public class SysRoleController extends BaseController
}
}
/**
* 修改保存数据权限
*/
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
@PostMapping("/roleCanteen/edit")
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理->食堂权限",details = "修改权限")
public AjaxResult rebuildRoleCanteenScope(@RequestBody SysRole role) {
try{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.rebuildRoleCanteenScope(role));
}catch (Exception e){
logger.error(e.toString(),e);
return error(e.getMessage());
}
}
/**
* 状态修改
*/

View File

@ -131,6 +131,8 @@ public interface ISysRoleService
public int rebuildRoleAreaScope(SysRole role);
public int rebuildRoleCanteenScope(SysRole role);
/**
* 通过角色ID删除角色
*

View File

@ -326,13 +326,19 @@ public class SysRoleServiceImpl implements ISysRoleService
// 删除角色与区域关联
roleAreaMapper.deleteRoleAreaByRoleId(role.getRoleId());
// 新增角色和区域信息数据权限
int count1 = insertRoleArea(role);
return insertRoleArea(role);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int rebuildRoleCanteenScope(SysRole role)
{
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与食堂档口关联
roleAreaMapper.deleteRoleCanteenByRoleId(role.getRoleId());
// 新增角色和食堂档口信息数据权限
int count2 = insertRoleCanteen(role);
return count1 + count2;
return insertRoleCanteen(role);
}
/**