Add BaseController

master
pk9tv8hgp 2 years ago
parent 1c7cf1b777
commit fe35e2ed6a

@ -0,0 +1,21 @@
package com.controller.admin;
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.AdminLoginNoException;
@Controller
public class BaseController {
/**
* 登录权限控制,处理方法执行前执行该方法
* @throws AdminLoginNoException
*/
@ModelAttribute
public void isLogin(HttpSession session, HttpServletRequest request) throws AdminLoginNoException {
if(session.getAttribute("auser") == null){
throw new AdminLoginNoException("没有登录");
}
}
}
Loading…
Cancel
Save