若依3.3
This commit is contained in:
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.AjaxResult.Type;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
@@ -113,11 +114,11 @@ public class SysDeptController extends BaseController
|
||||
{
|
||||
if (deptService.selectDeptCount(deptId) > 0)
|
||||
{
|
||||
return error(1, "存在下级部门,不允许删除");
|
||||
return error(Type.WARN, "存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return error(1, "部门存在用户,不允许删除");
|
||||
return error(Type.WARN, "部门存在用户,不允许删除");
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.AjaxResult.Type;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
@@ -61,11 +62,11 @@ public class SysMenuController extends BaseController
|
||||
{
|
||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||
{
|
||||
return error(1, "存在子菜单,不允许删除");
|
||||
return error(Type.WARN, "存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||
{
|
||||
return error(1, "菜单已分配,不允许删除");
|
||||
return error(Type.WARN, "菜单已分配,不允许删除");
|
||||
}
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
|
@@ -21,7 +21,6 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
@@ -43,9 +42,6 @@ public class SysProfileController extends BaseController
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@@ -53,7 +49,6 @@ public class SysProfileController extends BaseController
|
||||
public String profile(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex()));
|
||||
mmap.put("user", user);
|
||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||
|
@@ -18,7 +18,10 @@ import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
@@ -34,6 +37,9 @@ public class SysRoleController extends BaseController
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@RequiresPermissions("system:role:view")
|
||||
@GetMapping()
|
||||
public String role()
|
||||
@@ -111,26 +117,25 @@ public class SysRoleController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据权限
|
||||
* 角色分配数据权限
|
||||
*/
|
||||
@GetMapping("/rule/{roleId}")
|
||||
public String rule(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
@GetMapping("/authDataScope/{roleId}")
|
||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/rule";
|
||||
return prefix + "/dataScope";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
* 保存角色分配数据权限
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/rule")
|
||||
@PostMapping("/authDataScope")
|
||||
@ResponseBody
|
||||
public AjaxResult ruleSave(SysRole role)
|
||||
public AjaxResult authDataScopeSave(SysRole role)
|
||||
{
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(roleService.updateRule(role));
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
@@ -189,4 +194,84 @@ public class SysRoleController extends BaseController
|
||||
{
|
||||
return toAjax(roleService.changeStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配用户
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@GetMapping("/authUser/{roleId}")
|
||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/authUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/allocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancel")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancelAll")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择用户
|
||||
*/
|
||||
@GetMapping("/authUser/selectUser/{roleId}")
|
||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/selectUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/unallocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/selectAll")
|
||||
@ResponseBody
|
||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user