zoukankan      html  css  js  c++  java
  • 操作日志工具类

    public class OperLogUtil {
    
    	public static void log(String loginname,String content,HttpServletRequest request){
    		try {
    			if (content!=null && content.trim().length()>0) {
    			    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
    				OperlogsMapper mapper=(OperlogsMapper) context.getBean("operlogsMapper");
    				Operlogs log=new Operlogs();
    				log.setId(UUID.randomUUID().toString());
    				log.setContent(content);
    				log.setIp(request.getRemoteAddr());
    				log.setLoginname(loginname);
    				log.setOpertime(new Date());
    				
    				mapper.insert(log);
    				//MybatisSessionFactory.getSession().commit();
    			}
    		} catch (Exception e) {
    			try {
    				//MybatisSessionFactory.getSession().rollback();
    			} catch (Exception e1) {
    				e1.printStackTrace();
    			}
    			e.printStackTrace();
    		}
    	}
    }
    

      

  • 相关阅读:
    ACM-ICPC ShangHai 2014
    DEBUG感想
    WireShark 使用日记
    C++ 备忘录
    BZOJ 1022 [SHOI2008]小约翰的游戏John
    高斯消元
    BZOJ3236 [Ahoi2013]作业
    BZOJ P3293&&P1045
    ZKW费用流的理解
    BZOJ 几道水题 2014-4-22
  • 原文地址:https://www.cnblogs.com/a757956132/p/4560280.html
Copyright © 2011-2022 走看看