|
@@ -3,14 +3,13 @@ package com.gyee.table.controller;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.gyee.table.entity.SysUser;
|
|
|
import com.gyee.table.result.Result;
|
|
|
+import com.gyee.table.result.ResultCode;
|
|
|
import com.gyee.table.service.ISysUserService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author hlf
|
|
@@ -26,11 +25,22 @@ public class SysUserController {
|
|
|
private ISysUserService userService;
|
|
|
|
|
|
/**
|
|
|
+ * 获取所有用户
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getUserList")
|
|
|
+ public JSONObject getUserList() {
|
|
|
+ List<SysUser> list = userService.list();
|
|
|
+ return Result.successData(ResultCode.SUCCESS, list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 修改密码
|
|
|
*
|
|
|
- * @param id 用户ID
|
|
|
+ * @param id 用户ID
|
|
|
* @param originalPassword 旧密码
|
|
|
- * @param newPassword 新密码
|
|
|
+ * @param newPassword 新密码
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/changePassword")
|
|
@@ -38,7 +48,7 @@ public class SysUserController {
|
|
|
@RequestParam(value = "originalPassword") String originalPassword,
|
|
|
@RequestParam(value = "newPassword") String newPassword) {
|
|
|
SysUser user = userService.getById(id);
|
|
|
- if (!originalPassword.equals(user.getPassword())){
|
|
|
+ if (!originalPassword.equals(user.getPassword())) {
|
|
|
return Result.error();
|
|
|
}
|
|
|
user.setPassword(newPassword);
|