|
@@ -1,9 +1,13 @@
|
|
package com.zy.bms.controller;
|
|
package com.zy.bms.controller;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.zy.bms.common.ServerResponse;
|
|
import com.zy.bms.common.ServerResponse;
|
|
-import com.zy.bms.pojo.io.UserIO;
|
|
|
|
|
|
+import com.zy.bms.entity.User;
|
|
|
|
+import com.zy.bms.pojo.io.SearchIO;
|
|
|
|
+import com.zy.bms.service.IUserPrivilegeService;
|
|
import com.zy.bms.service.IUserService;
|
|
import com.zy.bms.service.IUserService;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@@ -21,11 +25,43 @@ public class UserController {
|
|
@Resource
|
|
@Resource
|
|
private IUserService userService;
|
|
private IUserService userService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IUserPrivilegeService userPrivilegeService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分页查询用户列表
|
|
* 分页查询用户列表
|
|
*/
|
|
*/
|
|
@GetMapping("listPage.do")
|
|
@GetMapping("listPage.do")
|
|
- public ServerResponse listPage(UserIO io) {
|
|
|
|
|
|
+ public ServerResponse listPage(SearchIO io) {
|
|
return ServerResponse.success(userService.listPage(io));
|
|
return ServerResponse.success(userService.listPage(io));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取用户未有权限的设备组
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("getNoAccessGroups.do")
|
|
|
|
+ public ServerResponse getNoAccessGroups(Integer userId) {
|
|
|
|
+ return ServerResponse.success(userPrivilegeService.getNoAccessGroups(userId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 设备组权限
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("saveGroupAccess.do")
|
|
|
|
+ public ServerResponse saveGroupAccess(Integer userId, String[] groups) {
|
|
|
|
+ userPrivilegeService.saveBatch(userId, groups);
|
|
|
|
+ return ServerResponse.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 管理员权限
|
|
|
|
+ *
|
|
|
|
+ * @param userId 用户ID
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("saveAdminAccess.do")
|
|
|
|
+ public ServerResponse saveAdminAccess(Integer userId) {
|
|
|
|
+ userService.update(new UpdateWrapper<User>().set("admin", 1).eq("id", userId));
|
|
|
|
+ return ServerResponse.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|