package web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.User;
import service.UserService;

import javax.servlet.http.HttpSession;

/**
 * 用户管理控制器
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 处理用户登录成功请求
     */
    @RequestMapping("/login")
    public String userLogin(User user, HttpSession session){
        User user1 = userService.userLogin(user);
        session.setAttribute("message",user1);
        return "redirect:/page/index";
    }
}
