forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
429e27e12a
@ -1,23 +1,33 @@
|
||||
package io.dataease.plugins.server;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.auth.annotation.DeLog;
|
||||
import io.dataease.auth.service.ExtAuthService;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.constants.SysLogConstants;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.controller.sys.response.DeptNodeResponse;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import io.dataease.plugins.common.entity.XpackGridRequest;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.dept.dto.request.XpackCreateDept;
|
||||
import io.dataease.plugins.xpack.dept.dto.request.XpackDeleteDept;
|
||||
import io.dataease.plugins.xpack.dept.dto.request.XpackMoveDept;
|
||||
import io.dataease.plugins.xpack.dept.dto.request.*;
|
||||
import io.dataease.plugins.xpack.dept.dto.response.DeptUserItemDTO;
|
||||
import io.dataease.plugins.xpack.dept.dto.response.XpackDeptTreeNode;
|
||||
import io.dataease.plugins.xpack.dept.dto.response.XpackSysDept;
|
||||
import io.dataease.plugins.xpack.dept.service.DeptXpackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@ -123,6 +133,7 @@ public class XDeptServer {
|
||||
return deptService.searchTree(deptId);
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("dept:edit")
|
||||
@ApiOperation("移动")
|
||||
@PostMapping("/move")
|
||||
@ -130,4 +141,41 @@ public class XDeptServer {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
deptService.move(xpackMoveDept);
|
||||
}
|
||||
|
||||
@RequiresPermissions({"dept:read", "user:read"})
|
||||
@ApiOperation("查询用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "request", value = "查询条件", required = true)
|
||||
})
|
||||
@PostMapping("/userGrid/{goPage}/{pageSize}")
|
||||
public Pager<List<DeptUserItemDTO>> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackDeptUserRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<DeptUserItemDTO> userItems = deptService.queryBinded(request);
|
||||
Pager<List<DeptUserItemDTO>> setPageInfo = PageUtils.setPageInfo(page, userItems);
|
||||
return setPageInfo;
|
||||
}
|
||||
|
||||
@RequiresPermissions({"dept:edit", "user:edit"})
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@PostMapping("/bindUser")
|
||||
public void bindUser(@RequestBody XpackDeptBindRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
deptService.bindUser(request);
|
||||
}
|
||||
|
||||
@RequiresPermissions({"dept:edit", "user:edit"})
|
||||
@PostMapping("/unBindUser")
|
||||
public void unBindUser(@RequestBody XpackDeptUnBindRequest request) {
|
||||
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
|
||||
if (CollectionUtil.isEmpty(request.getUserIds())) {
|
||||
DEException.throwException("userIds can not be empty");
|
||||
}
|
||||
request.getUserIds().forEach(userId -> {
|
||||
CacheUtils.remove( AuthConstants.USER_CACHE_NAME, "user" + userId);
|
||||
});
|
||||
deptService.unBindUsers(request);
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.auth.annotation.DeLog;
|
||||
import io.dataease.auth.service.ExtAuthService;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.constants.SysLogConstants;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import io.dataease.plugins.common.entity.XpackGridRequest;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.role.dto.request.RoleUserMappingDelRequest;
|
||||
@ -21,8 +23,10 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
@ -116,6 +120,7 @@ public class XRoleServer {
|
||||
|
||||
@RequiresPermissions({"role:edit", "user:edit"})
|
||||
@ApiOperation("绑定用户")
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@PostMapping("/bindUser")
|
||||
public void bindUser(@RequestBody RoleUserMappingRequest request) {
|
||||
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
|
||||
@ -127,6 +132,11 @@ public class XRoleServer {
|
||||
@PostMapping("/unBindUsers")
|
||||
public void unBindUsers(@RequestBody RoleUserMappingDelRequest request) {
|
||||
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
|
||||
if (CollectionUtils.isNotEmpty(request.getUserIds())) {
|
||||
request.getUserIds().forEach(userId -> {
|
||||
CacheUtils.remove( AuthConstants.USER_CACHE_NAME, "user" + userId);
|
||||
});
|
||||
}
|
||||
roleXpackService.batchDelUser(request);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user