版权声明:本文为博主原创文章,未经博主允许不得转载。 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
版权声明:本文为博主原创文章,转载请附上博文链接!

Service层获取HttpServletRequest request的更多相关文章

  1. [ionic开源项目教程] - 第4讲 通Service层获取数据列表

    第4讲:通Service层获取数据列表 上一讲中页面的基本架构已完成,这一讲介绍如何通过service层从服务器请求数据,在通过controller层为载体,显示到视图层. 1.在services.j ...

  2. spring在service层获取session和request

    首先要在web.xml增加如下代码: <listener> <listener-class>org.springframework.web.context.request.Re ...

  3. 通过.properties配置文件,在Service层获取值

    问题:从配置文件获取不到值的原因:1.静态变量:2.没通过Spring加载该实例对象. 1. conf.properties配置文件内容: 2. Spring加载配置文件内容,spring-confi ...

  4. SpringMVC 之 Controller、Service层职责

    Controller层 1.接收httpRequest/requestDTO数据 ,检查接收数据参数与格式. 2.传递参数至Service层并接收返回responseDTO数据. 3.包装respon ...

  5. 怎样在Web项目中的service业务层获取项目根路劲

    这里我们有两个前提 1.没有使用struts2框架.没有使用servlet,无法给service层传递request对象. 2.使用了Spring框架. 那你可能问.会有这样的情况吗?答案是有的,比方 ...

  6. 在spring的业务层获取request,response

    1.直接通过controller层获取到传输到业务层2.SpringMVC提供的RequestContextHolder可以直接获取代码: RequestAttributes requestAttri ...

  7. 页面间传递前端请求参数和获取参数:Model model,HttpServletRequest request, ModelMap map参数使用与区别

    Model model, HttpServletRequest request, ModelMap map声明变量 一.下面的方法是需要将请求发过来的数据(或者说参数)传递到重定向的页面/转发的页面的 ...

  8. HttpServletRequest request 获取form参数的两种方式

    @RequestMapping(value="/pay",method = RequestMethod.POST) public String buildRequest(HttpS ...

  9. 非controller层获取response和request对象

    ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttribute ...

随机推荐

  1. java基本类型和包装类型的区别

    Java的类型分为两部分,一个是基本类型(primitive),如int.double等八种基本数据类型: 另一个是引用类型(reference type),如String.List等.而每一个基本类 ...

  2. pycharm 的一个小问题

    版本:PyCharm 2018.3.7 (Professional Edition) 这段时间用pycharm写python代码,运行网上copy的代码.报错了也就是少个模块或者Python2的语法在 ...

  3. 机器学习四 SVM

    目录 引言 SVM 线性可分SVM 线性不可分SVM Hinge Loss 非线性SVM 核函数 总结 参考文献 引言 在深度神经网终(Deep Neural Network, DNN) 大热之前, ...

  4. JVM metaspace元空间

    元空间的本质和永久代类似,都是对JVM规范中方法区的实现. 元空间不在虚拟机中,而是使用本地内存. 用于元空间的JVM参数:   -XX:MetaspaceSize=N 初始化Metaspace大小, ...

  5. Comet OJ - Contest #14题解

    Contest14的本质:区间覆盖+Tarjan( A 把距离公式两边平方即可 注意要long long code #include <algorithm> #include <io ...

  6. datatable 和实体互转

    public static class ModelConvertHelper<T> where T : class,new() { public static List<T> ...

  7. html abbr标签 语法

    html abbr标签 语法 作用:标记一个缩写 大理石平台 说明:<abbr> 标签指示简称或缩写,比如 "WWW" 或 "NATO".通过对缩写 ...

  8. 使用webuploader组件实现大文件分片上传,断点续传

    本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...

  9. 2019.9.23JAVA课堂测试

    1.题目 使用递归方式判断某个字串是否是回文( palindrome ) “回文”是指正着读.反着读都一样的句子.比如“我是谁是我”使用递归算法检测回文的算法描述如下:A single or zero ...

  10. Spring Cloud云架构 - SSO单点登录之OAuth2.0登录流程(2)

    上一篇是站在巨人的肩膀上去研究OAuth2.0,也是为了快速帮助大家认识OAuth2.0,闲话少说,我根据框架中OAuth2.0的使用总结,画了一个简单的流程图(根据用户名+密码实现OAuth2.0的 ...