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.
22 lines
705 B
22 lines
705 B
2 years ago
|
package com.controller.before;
|
||
|
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import javax.servlet.http.HttpSession;
|
||
|
|
||
|
import org.springframework.stereotype.Controller;
|
||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||
|
|
||
|
import com.exception.UserLoginNoException;
|
||
|
@Controller
|
||
|
public class BaseBeforeController {
|
||
|
/**
|
||
|
* 前台用户登录权限控制,处理方法执行前执行该方法
|
||
|
* @throws UserLoginNoException
|
||
|
*/
|
||
|
@ModelAttribute
|
||
|
public void isLogin(HttpSession session, HttpServletRequest request) throws UserLoginNoException {
|
||
|
if(session.getAttribute("emailuser") == null){
|
||
|
throw new UserLoginNoException("没有登录");
|
||
|
}
|
||
|
}
|
||
|
}
|