• 操作日志工具类


    package com.util;
    
    import java.util.Date;
    import java.util.UUID;
    
    import javax.servlet.http.HttpServletRequest;
    
    import org.springframework.context.ApplicationContext;
    import org.springframework.web.context.support.WebApplicationContextUtils;
    
    import com.renmai.db.dao.OperlogsMapper;
    import com.renmai.db.model.Operlogs;
    
    
    
    
    /**
     * 操作日志工具类
     * @author renmai
     *2011-3-6
     */
    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();
    		}
    	}
    }
    

      

  • 相关阅读:
    长沙雅礼中学集训-------------------day1(内含day0)
    17年 5月份刷题版
    manecher_回文串;
    后缀数组
    湖南集训
    好像又好久没更了;计算课noip模拟赛;
    dp的练习题;
    oj1638
    【noi】植物大战僵尸
    #日常吐槽
  • 原文地址:https://www.cnblogs.com/a757956132/p/4538531.html
Copyright © 2020-2023  润新知