From d2b1476f5c856f4ada88c04f052d191614ce82f9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期日, 09 二月 2025 15:39:02 +0800
Subject: [PATCH] #
---
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
index e0eb9aa..383a5b0 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java
@@ -14,12 +14,12 @@
import com.vincent.rsf.server.system.entity.Menu;
import com.vincent.rsf.server.system.entity.User;
import com.vincent.rsf.server.system.entity.UserLogin;
-import com.vincent.rsf.server.system.service.RoleMenuService;
-import com.vincent.rsf.server.system.service.TenantService;
-import com.vincent.rsf.server.system.service.UserLoginService;
-import com.vincent.rsf.server.system.service.UserService;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import com.vincent.rsf.server.system.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -45,6 +45,8 @@
private RoleMenuService roleMenuService;
@Resource
private TenantService tenantService;
+ @Autowired
+ private UserRoleService userRoleService;
@PostMapping("/login")
public R login(@RequestBody LoginParam param, HttpServletRequest request) {
@@ -67,9 +69,16 @@
return R.ok("Login Success").add(new LoginResult(accessToken, user));
}
+ @GetMapping("/tenant/list")
+ public R tenantList() {
+ return R.ok().add(tenantService.list());
+ }
+
@GetMapping("/auth/user")
public R userInfo() {
- return R.ok(userService.getByIdRel(getLoginUserId()));
+ User user = userService.getByIdRel(getLoginUserId());
+ user.setRoles(userRoleService.listByUserId(user.getId()));
+ return R.ok(user);
}
@GetMapping("/auth/menu")
@@ -80,16 +89,8 @@
return R.ok().add(Utils.toTreeData(voList, 0L, MenuVo::getParentId, MenuVo::getId, MenuVo::setChildren));
}
-
-
- @GetMapping("/auth/tenant")
- public R authHost() {
- return R.ok().add(tenantService.list());
- }
-
- @PreAuthorize("hasAuthority('sys:auth:user')")
- @OperationLog
- @PutMapping("/auth/user")
+ @OperationLog("Update UserInfo")
+ @PostMapping("/auth/user")
public R updateInfo(@RequestBody User user) {
user.setId(getLoginUserId());
// 涓嶈兘淇敼鐨勫瓧娈�
@@ -99,14 +100,13 @@
user.setTenantId(null);
user.setStatus(null);
if (userService.updateById(user)) {
- return R.ok().add(userService.getByIdRel(user.getId()));
+ return R.ok("Save Success").add(userService.getByIdRel(user.getId()));
}
return R.error("Save Fail");
}
- @PreAuthorize("hasAuthority('sys:auth:password')")
- @OperationLog
- @PutMapping("/auth/password")
+ @OperationLog("Reset Password")
+ @PostMapping("/auth/password")
public R updatePassword(@RequestBody UpdatePasswordParam param) {
if (Cools.isEmpty(param.getOldPassword(), param.getPassword())) {
return R.error("Parameters Cannot Be Empty");
--
Gitblit v1.9.1