package com.bookStore.admin.admin.handler;
import com.bookStore.admin.admin.service.IAdminService;
import com.bookStore.commons.beans.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sound.midi.Soundbank;
import java.io.IOException;
/**
* company: www.abc.com
* Author: Administrator
* Create Data: 2019/4/19
*/
@Controller
@RequestMapping("/admin/admin")
public class IAdminHandler {
@Autowired
private IAdminService adminService;
@RequestMapping("/login.do")
public String login(User user, Model model, HttpSession session){
user=adminService.findUserByNameAndPassword(user);
if(user!=null){
if("超级管理员".equals(user.getRole())){
session.setAttribute("login_user",user);
return "/admin/login/home.jsp";
}else {
return "/admin/error/privilege.jsp";
}
}else {
model.addAttribute("message","账号或密码错误");
return "/admin/login/login.jsp";
}
}
@RequestMapping("/logout.do")
public String logout(HttpSession session, Model model){
session.removeAttribute("login_user");
model.addAttribute("message","退出成功");
return "/admin/login/login.jsp";
}
}
最近下载更多
zouzou123 LV3
2024年10月18日
微信网友_5986558820093952 LV4
2024年6月29日
TY0165 LV20
2024年6月24日
樱花味小然子 LV5
2024年6月20日
liyan54188 LV2
2024年6月19日
zeng1206 LV7
2024年6月16日
lh1234DGF LV2
2024年6月3日
xiexin LV1
2024年4月4日
夜上清元 LV8
2024年3月6日
微信网友_6790896063139840 LV1
2023年12月23日

最近浏览