1
|
package com.tianbo.warehouse.controller;
|
1
|
package com.tianbo.warehouse.controller;
|
2
|
|
2
|
|
|
|
3
|
+import com.tianbo.warehouse.annotation.LogAnnotation;
|
|
|
4
|
+import com.tianbo.warehouse.annotation.UserPasswordMd5;
|
|
|
5
|
+import com.tianbo.warehouse.controller.response.ResultJson;
|
3
|
import com.tianbo.warehouse.model.USERS;
|
6
|
import com.tianbo.warehouse.model.USERS;
|
4
|
import com.tianbo.warehouse.service.UserService;
|
7
|
import com.tianbo.warehouse.service.UserService;
|
|
|
8
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
9
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
10
|
+import io.swagger.annotations.ApiOperation;
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
6
|
import org.springframework.security.core.context.SecurityContextHolder;
|
12
|
import org.springframework.security.core.context.SecurityContextHolder;
|
7
|
import org.springframework.security.core.context.SecurityContextImpl;
|
13
|
import org.springframework.security.core.context.SecurityContextImpl;
|
8
|
import org.springframework.security.core.userdetails.UserDetails;
|
14
|
import org.springframework.security.core.userdetails.UserDetails;
|
9
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
10
|
-import org.springframework.web.bind.annotation.RestController;
|
15
|
+import org.springframework.web.bind.annotation.*;
|
11
|
|
16
|
|
12
|
import java.util.List;
|
17
|
import java.util.List;
|
13
|
|
18
|
|
14
|
@RestController
|
19
|
@RestController
|
|
|
20
|
+@RequestMapping("/admin")
|
15
|
public class AdminController {
|
21
|
public class AdminController {
|
16
|
|
22
|
|
17
|
@Autowired
|
23
|
@Autowired
|
18
|
UserService userService;
|
24
|
UserService userService;
|
19
|
|
25
|
|
20
|
- @GetMapping("/admin")
|
26
|
+ @GetMapping("/")
|
21
|
public String admin(){
|
27
|
public String admin(){
|
22
|
return "admin";
|
28
|
return "admin";
|
23
|
}
|
29
|
}
|
24
|
|
30
|
|
|
|
31
|
+ @ApiOperation(value = "修改用户密码", notes = "超级管理修改其他用户密码")
|
|
|
32
|
+ @LogAnnotation(moduleName = "admin管理",operate = "用户密码修改")
|
|
|
33
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "USERS", value = "用户账号密码", required = true, dataType = "USERS")})
|
|
|
34
|
+ @UserPasswordMd5
|
|
|
35
|
+ @PutMapping("/password")
|
|
|
36
|
+ public ResultJson updateUserPassById(@RequestBody USERS user){
|
|
|
37
|
+ int i = userService.updateByPrimaryKeySelective(user);
|
|
|
38
|
+ return i==1 ? new ResultJson("200","success") :new ResultJson("500","update password faild");
|
|
|
39
|
+ }
|
25
|
|
40
|
|
26
|
} |
41
|
} |