版权声明:本文为博主原创文章,未经博主允许不得转载。 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. mariadb增删改查

    数据库用户的操作 登录前需先启动3306端口. 首次启动需初始化数据库 mysql_secure_installation 增/改: 创建用户及赋予用户指定权限 grant 权限(分为create[创 ...

  2. PHP漏洞函数

    1. is_numeric函数 bool is_numeric ( mixed $var ) 此函数用于判断变量是否数字或者数字字符串,不仅能接受十进制,还能接受十六进制,这样就有了绕过的方法 < ...

  3. AD使用adsi 组件 获取域信息

    // testadsi.cpp : 定义控制台应用程序的入口点.// #include "stdafx.h"#include "windows.h"#inclu ...

  4. 【视频点播最佳实践】使用OSS SDK上传视频到点播

    摘要: 场景 点播上传SDK缺乏需要的语言版本(如C/C++.Go等)或相应的功能(如网络流上传.追加上传),可以直接使用OSS的SDK进行上传. 准备工作 确认已开通点播服务并完成了相关配置.确认已 ...

  5. Java AtomicInteger类的使用方法详解_java - JAVA

    文章来源:嗨学网 敏而好学论坛www.piaodoo.com 欢迎大家相互学习 首先看两段代码,一段是Integer的,一段是AtomicInteger的,为以下: public class Samp ...

  6. 11. ClustrixDB 管理文件空间和数据库容量

    ClustrixDB监视集群中可用的空间量,并主动警告潜在的容量问题.确定集群容量的阈值是可配置的,如下所述. 存储类型 要了解如何管理设备和数据库的利用率,必须首先了解ClustrixDB如何分配磁 ...

  7. BZOJ 4653: [Noi2016]区间 双指针 + 线段树

    只要一堆线段有重叠次数大于等于 $m$ 次的位置,那么一定有解 因为重叠 $m$ 次只需 $m$ 个线断,将那些多余的线断排除掉即可 先将区间按照长度从小到大排序,再用 $two-pointer$ 从 ...

  8. Sdoi2017试题泛做

    Day1 [Sdoi2017]数字表格 推式子的莫比乌斯反演题. #include <cstdio> #include <algorithm> #include <cst ...

  9. 【bzoj1189】[HNOI2007]紧急疏散evacuate

    *题目描述: 发生了火警,所有人员需要紧急疏散!假设每个房间是一个N M的矩形区域.每个格子如果是’.’,那么表示这是一块空地:如果是’X’,那么表示这是一面墙,如果是’D’,那么表示这是一扇门,人们 ...

  10. Oracle数据库锁表查询

    --查看数据库最大连接数 select value from v$parameter where name = 'processes'; --更改数据库连接数 alter system scope = ...