zoukankan      html  css  js  c++  java
  • Service层获取HttpServletRequest request

    版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liuyunshengsir/article/details/78183058
    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
    .getRequestAttributes()).getRequest();
    //操作日志基本字段
    OperationLog operationLog=new OperationLog();
    operationLog.setOperationLogId(UUIDUtils.create());
    operationLog.setOperationPeople(request.getSession().getAttribute("userName").toString());
    operationLog.setOperationDate(new Date());
    operationLog.setOperationModule("组织架构管理");
    //操作前
    sysDepartmentDao.selectByPrimaryKey(sysDepartment.getCreateId());
    String beforeContent="部门名称:"+sysDepartment.getDepartmentName()+
    ",部门简介:"+sysDepartment.getDepartmentInfo()+
    ",状态:"+sysDepartment.getIsValid();
    operationLog.setOperationIp(request.getLocalAddr());
    int count = 0;
    count = sysDepartmentDao.updateByPrimaryKeySelective(sysDepartment);
    if(count==1){
    //操作后
    sysDepartmentDao.selectByPrimaryKey(sysDepartment.getCreateId());
    String afterContent="部门名称:"+sysDepartment.getDepartmentName()+
    ",部门简介:"+sysDepartment.getDepartmentInfo()+
    ",状态:"+sysDepartment.getIsValid();
    operationLog.setOperationContent("操作前:("+beforeContent+")操作后:("+afterContent+")");
    operationLog.setOperationResult("成功");
    operationLogDao.insertOperationLogInfo(operationLog);
    }else{
    operationLog.setOperationResult("失败");
    operationLogDao.insertOperationLogInfo(operationLog);
    }
    return count;

    ---------------------
    作者:liuyunshengsir
    来源:CSDN
    原文:https://blog.csdn.net/liuyunshengsir/article/details/78183058
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    TFS实现需求工作项自动级联保存
    Oracle PL/SQL Developer集成TFS进行团队脚本文件版本管理
    TFS2017持续集成构建
    TFS 测试用例步骤数据统计
    精细化容量管理的设备成本优化之路
    腾讯Web工程师的前端书单
    React Native For Android 架构初探
    SQL系列(八)—— 分组(group by)
    SQL系列(七)—— 相似(like)
    SQL系列(六)—— 过滤(where)
  • 原文地址:https://www.cnblogs.com/Jeely/p/10811874.html
Copyright © 2011-2022 走看看