|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
@ -9,6 +10,7 @@ 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.platform.bean.SysRefRoleMenu;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserRole;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
@ -24,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -43,6 +46,9 @@ public class SysRoleController extends CoreBaseController{
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysRoleService sysRoleService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPersonnelService personnelService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增系统角色
|
|
|
|
|
* @param role 角色信息
|
|
|
|
@ -141,6 +147,19 @@ public class SysRoleController extends CoreBaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/list-user")
|
|
|
|
|
@ApiOperation(value = "查询角色", notes = "查询用户所拥有的角色信息")
|
|
|
|
|
public ResultBean findSysRoleByUser() {
|
|
|
|
|
try {
|
|
|
|
|
List<SysRole> result = personnelService.findSysRoleByUserId(getSessionUser().getUser().getId());
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询所有角色
|
|
|
|
|
* @param ids 角色id数组
|
|
|
|
@ -191,10 +210,16 @@ public class SysRoleController extends CoreBaseController{
|
|
|
|
|
@ApiOperation(value="查询角色",notes="组合查询角色,外带分页功能")
|
|
|
|
|
public ResultBean querySysRole(SysRole role, Pager pager){
|
|
|
|
|
try{
|
|
|
|
|
ListPager<SysRole> listPager = sysRoleService.querySysRole(role, pager);
|
|
|
|
|
List<SysRefUserRole> refList = personnelService.findSysRefUserRoleById(getSessionUser().getUser().getId());
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setListPager(listPager)
|
|
|
|
|
if(refList != null && refList.size() > 0){
|
|
|
|
|
List<Long> idList = new ArrayList<>(refList.size());
|
|
|
|
|
refList.forEach(ref -> idList.add(ref.getRoleId()));
|
|
|
|
|
|
|
|
|
|
return ResultBean.success("操作成功").setListPager(sysRoleService.querySysRole(role, idList, pager))
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
}catch(ImppBusiException busExcep){
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|