cool.happycoding.code.user.sample.rest.UserContextController Maven / Gradle / Ivy
package cool.happycoding.code.user.sample.rest;
import cool.happycoding.code.base.result.BaseResult;
import cool.happycoding.code.base.user.User;
import cool.happycoding.code.user.CurrentUser;
import cool.happycoding.code.user.DefaultUser;
import cool.happycoding.code.user.context.UserContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* description
*
* @author lanlanhappy 2020/12/04 9:47 下午
*/
@RestController("user-context")
public class UserContextController {
@GetMapping("defaultUser")
public BaseResult defaultUser(){
return BaseResult.success(UserContextHolder.getUser());
}
@GetMapping("currentUser")
public BaseResult currentUser(@CurrentUser DefaultUser defaultUser){
return BaseResult.success(defaultUser);
}
}