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;