Browse Source

用户分页条件查询修改

gao.qiang 1 year ago
parent
commit
a5094ef314

+ 8 - 8
hazard-admin/src/main/java/com/ozs/web/controller/system/SysUserController.java

@@ -57,8 +57,8 @@ public class SysUserController extends BaseController {
      * 获取用户列表
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(SysUser user) {
+    @PostMapping("/list")
+    public TableDataInfo list(@RequestBody SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUserList(user);
         return getDataTable(list);
@@ -107,14 +107,14 @@ public class SysUserController extends BaseController {
      * 根据用户编号获取详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:user:query')")
-    @GetMapping(value = {"/", "/{userId}"})
-    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
-        userService.checkUserDataScope(userId);
+    @GetMapping(value = {"/", "/{id}"})
+    public AjaxResult getInfo(@PathVariable(value = "id", required = false) Long id) {
+        userService.checkUserDataScope(id);
         AjaxResult ajax = AjaxResult.success();
         List<SysRole> roles = roleService.selectRoleAll();
-        ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
-        if (StringUtils.isNotNull(userId)) {
-            SysUser sysUser = userService.selectUserById(userId);
+        ajax.put("roles", SysUser.isAdmin(id) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
+        if (StringUtils.isNotNull(id)) {
+            SysUser sysUser = userService.selectUserById(id);
             ajax.put(AjaxResult.DATA_TAG, sysUser);
             ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
         }