版权声明:本文为博主原创文章,未经博主允许不得转载。 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. docker search - 搜寻镜像

    使用docker search 命令可以搜索docker hub官方仓库中的镜像. # docker search --help Usage: docker search [OPTIONS] TERM ...

  2. C/C++ 零碎知识点

    传递参数的一般指导原则: 对于使用传递的值而不做修改的函数: 如果数据对象很小,比如内置类型或者小型结构,按值传递. 如果数据对象是数组,只能使用指针,并将指针生命为指向const的指针. 如果数据对 ...

  3. 文件I/O编程 (fcntl)

    Fcntl函数语法要点所需头文件:#include          #include          #include函数原型:int fcntl(int fd,cmd,struct flock ...

  4. C++ STL(一)string的用法

    # 1.string的用法- string在<iostream>的头中就有,但是还是得用<string>的头 ##### 构造函数- str(const char* ch) 直 ...

  5. Mac下安装nginx并配置SSL实现Https的访问

    一.nginx安装 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/insta ...

  6. [易学易懂系列|rustlang语言|零基础|快速入门|(10)|Vectors容器]

    [易学易懂系列|rustlang语言|零基础|快速入门|(10)] 有意思的基础知识 Vectors 我们之前知道array数组是定长,只可我保存相同类型的数据的数据类型. 如果,我们想用不定长的数组 ...

  7. xmlns, xmlns:xsi, xsi:schemaLocation 解释

    xmlns, xmlns:xsi, xsi:schemaLocation 解释 xmlnsxsischemaLocation 我们在写 xml 文件时,尤其是 spring .mybatis 的配置文 ...

  8. java作业利用递归解决问题

    第一题 利用递归求组合数 设计思想 (1)首先根据公式求,利用递归完成阶乘函数的初始化,并且通过调用阶乘,实现公式计算 (2)递推方法,根据杨辉三角的特点,设置二维数组,从上到下依次保存杨辉三角所得数 ...

  9. 【NOIP2016提高A组模拟8.15】Throw

    题目 分析 首先对于一个状态(a,b,c),假定a<=b<=c: 现在考虑一下这个状态,的转移方案: \[1,中间向两边跳(a,b,c)-->(a*2-b,a,c).(a,b,c)- ...

  10. 【shell】sed处理多行合并

    有这么一个题 文件格式 table=t1 name owner address table=t2 id text col1 comment col5 table=t3 prod_name price ...