forked from github/dataease
refactor: 用户列表与仪表板分享用户接口分离
This commit is contained in:
parent
79d0fd2397
commit
25a1badbd0
@ -1,6 +1,5 @@
|
||||
package io.dataease.controller.sys;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
@ -49,27 +48,33 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:read")
|
||||
@PostMapping("/userGrid/{goPage}/{pageSize}")
|
||||
@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)
|
||||
@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)
|
||||
})
|
||||
public Pager<List<SysUserGridResponse>> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
public Pager<List<SysUserGridResponse>> userGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, sysUserService.query(request));
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@PostMapping("/userLists")
|
||||
public List<SysUserGridResponse> userLists(@RequestBody BaseGridRequest request) {
|
||||
return sysUserService.query(request);
|
||||
}
|
||||
|
||||
@ApiOperation("创建用户")
|
||||
@RequiresPermissions("user:add")
|
||||
@PostMapping("/create")
|
||||
public void create(@RequestBody SysUserCreateRequest request){
|
||||
public void create(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.save(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@RequiresPermissions("user:edit")
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody SysUserCreateRequest request){
|
||||
public void update(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.update(request);
|
||||
}
|
||||
|
||||
@ -77,33 +82,32 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:del")
|
||||
@PostMapping("/delete/{userId}")
|
||||
@ApiImplicitParam(paramType = "path", value = "用户ID", name = "userId", required = true, dataType = "Integer")
|
||||
public void delete(@PathVariable("userId") Long userId){
|
||||
public void delete(@PathVariable("userId") Long userId) {
|
||||
sysUserService.delete(userId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("更新用户状态")
|
||||
@RequiresPermissions("user:edit")
|
||||
@RequiresRoles("1")
|
||||
@PostMapping("/updateStatus")
|
||||
public void updateStatus(@RequestBody SysUserStateRequest request){
|
||||
public void updateStatus(@RequestBody SysUserStateRequest request) {
|
||||
sysUserService.updateStatus(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新当前用户密码")
|
||||
@PostMapping("/updatePwd")
|
||||
public void updatePwd(@RequestBody SysUserPwdRequest request){
|
||||
public void updatePwd(@RequestBody SysUserPwdRequest request) {
|
||||
|
||||
sysUserService.updatePwd(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新指定用户密码")
|
||||
@RequiresPermissions("user:editPwd")
|
||||
@PostMapping("/adminUpdatePwd")
|
||||
public void adminUpdatePwd(@RequestBody SysUserPwdRequest request){
|
||||
public void adminUpdatePwd(@RequestBody SysUserPwdRequest request) {
|
||||
sysUserService.adminUpdatePwd(request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("当前用户信息")
|
||||
@PostMapping("/personInfo")
|
||||
public CurrentUserDto personInfo() {
|
||||
@ -114,13 +118,13 @@ public class SysUserController {
|
||||
@ApiIgnore
|
||||
@ApiOperation("更新个人信息")
|
||||
@PostMapping("/updatePersonInfo")
|
||||
public void updatePersonInfo(@RequestBody SysUserCreateRequest request){
|
||||
public void updatePersonInfo(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.updatePersonInfo(request);
|
||||
}
|
||||
|
||||
@ApiOperation("设置语言")
|
||||
@PostMapping("/setLanguage/{language}")
|
||||
@ApiImplicitParam(paramType="path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String")
|
||||
@ApiImplicitParam(paramType = "path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String")
|
||||
public void setLanguage(@PathVariable String language) {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
Optional.ofNullable(language).ifPresent(currentLanguage -> {
|
||||
@ -132,28 +136,24 @@ public class SysUserController {
|
||||
|
||||
@ApiOperation("查询所有角色")
|
||||
@PostMapping("/all")
|
||||
public List<RoleUserItem> all(){
|
||||
public List<RoleUserItem> all() {
|
||||
return sysRoleService.allRoles();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@ApiIgnore("查询角色")
|
||||
@PostMapping("/roleGrid/{goPage}/{pageSize}")
|
||||
@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)
|
||||
@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)
|
||||
})
|
||||
public Pager<List<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
public Pager<List<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
Pager<List<SysRole>> listPager = PageUtils.setPageInfo(page, sysRoleService.query(request));
|
||||
return listPager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("已同步用户")
|
||||
@PostMapping("/existLdapUsers")
|
||||
public List<ExistLdapUser> getExistLdapUsers() {
|
||||
|
@ -4,6 +4,7 @@ const pathMap = {
|
||||
personInfoPath: '/api/user/personInfo/',
|
||||
piupdatePath: '/api/user/updatePersonInfo/',
|
||||
queryPath: '/api/user/userGrid/',
|
||||
queryWithOutPagePath: '/api/user/userLists',
|
||||
deletePath: '/api/user/delete/',
|
||||
createPath: '/api/user/create',
|
||||
updatePath: '/api/user/update',
|
||||
@ -19,6 +20,15 @@ export function userLists(page, size, data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function userListsWithOutPage(data) {
|
||||
return request({
|
||||
url: pathMap.queryWithOutPagePath,
|
||||
method: 'post',
|
||||
data,
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export const addUser = (data) => {
|
||||
return request({
|
||||
url: pathMap.createPath,
|
||||
|
@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userLists } from '@/api/system/user'
|
||||
import { userListsWithOutPage } from '@/api/system/user'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { loadShares } from '@/api/panel/share'
|
||||
/* import { saveShare, loadShares } from '@/api/panel/share' */
|
||||
@ -69,10 +69,10 @@ export default {
|
||||
search(condition) {
|
||||
const temp = formatCondition(condition)
|
||||
const param = temp || {}
|
||||
userLists(1, 0, param).then(response => {
|
||||
userListsWithOutPage(param).then(response => {
|
||||
const data = response.data
|
||||
this.data = data.listObject.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.tableData = data.listObject.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.data = data.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.tableData = data.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.queryShareNodeIds()
|
||||
})
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user