|
|
@ -4,12 +4,13 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.RefRoleMenu;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
@ -20,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.websocket.server.PathParam;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -37,7 +37,6 @@ public class SysRoleController {
|
|
|
|
|
|
|
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysRoleController.class);
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysRoleController.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ISysRoleService sysRoleService;
|
|
|
|
private ISysRoleService sysRoleService;
|
|
|
|
|
|
|
|
|
|
|
@ -51,6 +50,9 @@ public class SysRoleController {
|
|
|
|
|
|
|
|
|
|
|
|
//新增初始化
|
|
|
|
//新增初始化
|
|
|
|
ConvertBean.modelInitialize(role, AuthUtil.getSessionUser());
|
|
|
|
ConvertBean.modelInitialize(role, AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
role.setRoleStatusId(CommonEnumUtil.DATA_STATUS.ENABLE.getValue());
|
|
|
|
|
|
|
|
role.setRedMenuNumber(0);
|
|
|
|
|
|
|
|
role.setRedModuleNumber(0);
|
|
|
|
|
|
|
|
|
|
|
|
role = sysRoleService.insertSysRole(role);
|
|
|
|
role = sysRoleService.insertSysRole(role);
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(role);
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(role);
|
|
|
@ -118,8 +120,27 @@ public class SysRoleController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/find-ref-menu/{roleId}")
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询角色的所有角色权限关系", notes = "查询角色的所有角色权限关系")
|
|
|
|
|
|
|
|
public ResultBean findRefRoleMenu(@PathVariable("roleId") String roleId) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(roleId, "角色id 不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RefRoleMenu> list = sysRoleService.findRefRoleMenuByRoleId(roleId);
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
|
|
|
|
|
|
|
|
.setResultList(list);
|
|
|
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}", busExcep.getErrorDetail(), busExcep);
|
|
|
|
|
|
|
|
return ResultBean.fail(busExcep.getErrorShow());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
LOGGER.error(ImppExceptionEnum.SYSTEM_EXCEPTION.getDescription() + ":{}", e.getMessage(), e);
|
|
|
|
|
|
|
|
return ResultBean.fail().setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value="/query")
|
|
|
|
@GetMapping(value="/query")
|
|
|
|
@ApiOperation(value="查询所有角色",notes="查询所有角色")
|
|
|
|
@ApiOperation(value="查询角色",notes="组合查询角色,外带分页功能")
|
|
|
|
public ResultBean querySysRole(SysRole role, Pager pager){
|
|
|
|
public ResultBean querySysRole(SysRole role, Pager pager){
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
ListPager<SysRole> listPager = sysRoleService.querySysRole(role, pager);
|
|
|
|
ListPager<SysRole> listPager = sysRoleService.querySysRole(role, pager);
|
|
|
@ -179,6 +200,8 @@ public class SysRoleController {
|
|
|
|
@ApiOperation(value = "批量修改系统角色状态", notes = "根据ID修改系统角色状态")
|
|
|
|
@ApiOperation(value = "批量修改系统角色状态", notes = "根据ID修改系统角色状态")
|
|
|
|
public ResultBean updateBatchStatus(String[] ids,int status) {
|
|
|
|
public ResultBean updateBatchStatus(String[] ids,int status) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
ids = ConvertBean.modelSafeArrayNumber(ids,true);
|
|
|
|
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
// 数据校验
|
|
|
|
ValidatorBean.checkNotNull(ids, "角色id 不能为空");
|
|
|
|
ValidatorBean.checkNotNull(ids, "角色id 不能为空");
|
|
|
|
ValidatorBean.checkNotZero(status, "角色状态不能为空");
|
|
|
|
ValidatorBean.checkNotZero(status, "角色状态不能为空");
|
|
|
@ -201,7 +224,8 @@ public class SysRoleController {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 数据校验
|
|
|
|
// 数据校验
|
|
|
|
ValidatorBean.checkNotNull(roleId, "角色roleId 不能为空");
|
|
|
|
ValidatorBean.checkNotNull(roleId, "角色roleId 不能为空");
|
|
|
|
ValidatorBean.checkNotZero(refIds, "角色状态不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
ConvertBean.modelSafeArrayNumber(refIds,true);
|
|
|
|
|
|
|
|
|
|
|
|
sysRoleService.refreshSysRoleRef(roleId,refIds,AuthUtil.getSessionUser());
|
|
|
|
sysRoleService.refreshSysRoleRef(roleId,refIds,AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
|
|
|
@ -215,14 +239,22 @@ public class SysRoleController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PutMapping(value = "/ref-menu/batch-insert")
|
|
|
|
@PutMapping(value = "/ref-menu/batch-insert")
|
|
|
|
@ApiOperation(value = "批量新增角色权限关系", notes = "批量新增角色权限关系")
|
|
|
|
@ApiOperation(value = "批量新增角色权限关系", notes = "批量新增角色权限关系")
|
|
|
|
public ResultBean insertBatchRefMenu(String[] roleIds,String[] menuIds) {
|
|
|
|
public ResultBean insertBatchRefMenu(String[] roleIds,String[] menuIds) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 数据校验
|
|
|
|
// 数据校验
|
|
|
|
ValidatorBean.checkNotNull(roleIds, "角色roleIds 不能为空");
|
|
|
|
ValidatorBean.checkNotNull(roleIds, "角色roleIds 不能为空");
|
|
|
|
ValidatorBean.checkNotNull(menuIds, "权限menuIds 不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
roleIds = ConvertBean.modelSafeArrayNumber(roleIds,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(roleIds.length == 0){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("请输入需要更新的角色信息。")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sysRoleService.refreshBatchSysRoleRef(roleIds,menuIds,AuthUtil.getSessionUser());
|
|
|
|
sysRoleService.refreshBatchSysRoleRef(roleIds,menuIds,AuthUtil.getSessionUser());
|
|
|
|
|
|
|
|
|
|
|
|