use of com.itrus.portal.db.AdminLog in project portal by ixinportal.
the class ItrusPortalUserLoginSucess method onAuthenticationSuccess.
public void onAuthenticationSuccess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Authentication authentication) throws javax.servlet.ServletException, IOException {
// 查询用户信息
AdminExample adminex = new AdminExample();
adminex.or().andAccountEqualTo(authentication.getName().toLowerCase());
Admin admin = sqlSession.selectOne("com.itrus.portal.db.AdminMapper.selectByExample", adminex);
if (admin != null) {
AdminLog adminlog = new AdminLog();
adminlog.setAdmin(admin.getId());
adminlog.setCreateTime(new Date());
adminlog.setType("登录成功");
adminlog.setInfo("登录成功,管理员: " + admin.getAccount());
adminlog.setIp(request.getRemoteAddr());
int ret = sqlSession.insert("com.itrus.portal.db.AdminLogMapper.insert", adminlog);
// System.out.println("insert ret = " + ret);
}
setDefaultTargetUrl("/index");
super.onAuthenticationSuccess(request, response, authentication);
}
Aggregations