whycxzp
2021-11-04 fd6c1811135d080fff6cb8349f3f251985b11238
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.pojo.UserInf;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("changeUser")
@Api(tags = "切换用户")
public class ChangeUserController {
 
    @PutMapping
    @ApiOperation(value = "切换用户")
    public void changeUser(@RequestParam Long userId){
        UserInf userInf = new UserInf();
        userInf.setUName("superuser");
        userInf.setUId(userId);
        ActionUtil.getSession().setAttribute("user",userInf);
    }
 
}