You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
5 months ago
|
package com.qsd.orange.controller;
|
||
|
|
||
|
import com.qsd.orange.po.SysUser;
|
||
|
import com.qsd.orange.service.UserService;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.security.core.Authentication;
|
||
|
import org.springframework.security.core.userdetails.User;
|
||
|
import org.springframework.stereotype.Controller;
|
||
|
import org.springframework.ui.Model;
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
|
||
|
@Controller
|
||
|
public class RouteController {
|
||
|
|
||
|
@Autowired
|
||
|
private UserService userService;
|
||
|
|
||
|
@GetMapping("")
|
||
|
public String index(Model model, Authentication authentication){
|
||
|
User users = (User)authentication.getPrincipal();
|
||
|
SysUser user = userService.getInfo(users.getUsername());
|
||
|
model.addAttribute("name", user.getName());
|
||
|
model.addAttribute("type", user.getType());
|
||
|
return "index";
|
||
|
}
|
||
|
|
||
|
@GetMapping("self")
|
||
|
public String self(Model model, Authentication authentication){
|
||
|
User users = (User)authentication.getPrincipal();
|
||
|
SysUser user = userService.getInfo(users.getUsername());
|
||
|
model.addAttribute("user", user);
|
||
|
return "self";
|
||
|
}
|
||
|
|
||
|
}
|