org.jeecg.modules.system.entity.SysLog Java Examples

The following examples show how to use org.jeecg.modules.system.entity.SysLog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysLogController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #2
Source File: SysLogController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #3
Source File: SysLogController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #4
Source File: SysLogController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #5
Source File: SysLogController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:删除单个日志记录
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysLog> result = new Result<SysLog>();
	SysLog sysLog = sysLogService.getById(id);
	if(sysLog==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysLogService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #6
Source File: SysLogController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 包存日志
 * @param jsonObject
 * @return
 */
@PostMapping("/save")
public Result<?> add(@RequestBody JSONObject jsonObject) {
	Result<?> result = new Result<>();
	SysLog log = JSON.parseObject(jsonObject.toJSONString(),SysLog.class);
	sysLogService.save(log);
	return result;
}
 
Example #7
Source File: SysLogController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:删除单个日志记录
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysLog> result = new Result<SysLog>();
	SysLog sysLog = sysLogService.getById(id);
	if(sysLog==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysLogService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #8
Source File: SysLogController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:删除单个日志记录
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysLog> result = new Result<SysLog>();
	SysLog sysLog = sysLogService.getById(id);
	if(sysLog==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysLogService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #9
Source File: SysLogController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:删除单个日志记录
 * @param id
 * @return
 */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) {
	Result<SysLog> result = new Result<SysLog>();
	SysLog sysLog = sysLogService.getById(id);
	if(sysLog==null) {
		result.error500("未找到对应实体");
	}else {
		boolean ok = sysLogService.removeById(id);
		if(ok) {
			result.success("删除成功!");
		}
	}
	return result;
}
 
Example #10
Source File: AutoLogAspect.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
	MethodSignature signature = (MethodSignature) joinPoint.getSignature();
	Method method = signature.getMethod();

	SysLog sysLog = new SysLog();
	AutoLog syslog = method.getAnnotation(AutoLog.class);
	if(syslog != null){
		//注解上的描述,操作日志内容
		sysLog.setLogContent(syslog.value());
		sysLog.setLogType(syslog.logType());

	}

	//请求的方法名
	String className = joinPoint.getTarget().getClass().getName();
	String methodName = signature.getName();
	sysLog.setMethod(className + "." + methodName + "()");


	//设置操作类型
	if (sysLog.getLogType() == CommonConstant.LOG_TYPE_2) {
		sysLog.setOperateType(getOperateType(methodName, syslog.operateType()));
	}

	//获取request
	HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
	//请求的参数
	sysLog.setRequestParam(getReqestParams(request,joinPoint));

	//设置IP地址
	sysLog.setIp(IPUtils.getIpAddr(request));

	//获取登录用户信息
	LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
	if(sysUser!=null){
		sysLog.setUserid(sysUser.getUsername());
		sysLog.setUsername(sysUser.getRealname());

	}
	//耗时
	sysLog.setCostTime(time);
	sysLog.setCreateTime(new Date());
	//保存系统日志
	JSONObject jsonObject = (JSONObject) JSONObject.toJSON(sysLog);
	sysBaseRemoteApi.saveSysLog(jsonObject);
}
 
Example #11
Source File: AutoLogAspect.java    From jeecg-boot-with-activiti with MIT License 4 votes vote down vote up
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
	MethodSignature signature = (MethodSignature) joinPoint.getSignature();
	Method method = signature.getMethod();

	SysLog sysLog = new SysLog();
	AutoLog syslog = method.getAnnotation(AutoLog.class);
	if(syslog != null){
		//注解上的描述,操作日志内容
		sysLog.setLogContent(syslog.value());
		sysLog.setLogType(syslog.logType());
		
	}

	//请求的方法名
	String className = joinPoint.getTarget().getClass().getName();
	String methodName = signature.getName();
	sysLog.setMethod(className + "." + methodName + "()");
	
	
	//设置操作类型
	if (sysLog.getLogType() == CommonConstant.LOG_TYPE_2) {
		sysLog.setOperateType(getOperateType(methodName, syslog.operateType()));
	}

	//请求的参数
	Object[] args = joinPoint.getArgs();
	try{
		String params = JSONObject.toJSONString(args);
		sysLog.setRequestParam(params);
	}catch (Exception e){

	}

	//获取request
	HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
	//设置IP地址
	sysLog.setIp(IPUtils.getIpAddr(request));

	//获取登录用户信息
	LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
	if(sysUser!=null){
		sysLog.setUserid(sysUser.getUsername());
		sysLog.setUsername(sysUser.getRealname());

	}
	//耗时
	sysLog.setCostTime(time);
	sysLog.setCreateTime(new Date());
	//保存系统日志
	sysLogService.save(sysLog);
}
 
Example #12
Source File: AutoLogAspect.java    From teaching with Apache License 2.0 4 votes vote down vote up
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
	MethodSignature signature = (MethodSignature) joinPoint.getSignature();
	Method method = signature.getMethod();

	SysLog sysLog = new SysLog();
	AutoLog syslog = method.getAnnotation(AutoLog.class);
	if(syslog != null){
		//注解上的描述,操作日志内容
		sysLog.setLogContent(syslog.value());
		sysLog.setLogType(syslog.logType());
		
	}

	//请求的方法名
	String className = joinPoint.getTarget().getClass().getName();
	String methodName = signature.getName();
	sysLog.setMethod(className + "." + methodName + "()");
	
	
	//设置操作类型
	if (sysLog.getLogType() == CommonConstant.LOG_TYPE_2) {
		sysLog.setOperateType(getOperateType(methodName, syslog.operateType()));
	}

	//请求的参数
	Object[] args = joinPoint.getArgs();
	try{
		String params = JSONObject.toJSONString(args);
		sysLog.setRequestParam(params);
	}catch (Exception e){

	}

	//获取request
	HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
	//设置IP地址
	sysLog.setIp(IPUtils.getIpAddr(request));

	//获取登录用户信息
	LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
	if(sysUser!=null){
		sysLog.setUserid(sysUser.getUsername());
		sysLog.setUsername(sysUser.getRealname());

	}
	//耗时
	sysLog.setCostTime(time);
	sysLog.setCreateTime(new Date());
	//保存系统日志
	sysLogService.save(sysLog);
}
 
Example #13
Source File: AutoLogAspect.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
	MethodSignature signature = (MethodSignature) joinPoint.getSignature();
	Method method = signature.getMethod();

	SysLog sysLog = new SysLog();
	AutoLog syslog = method.getAnnotation(AutoLog.class);
	if(syslog != null){
		//注解上的描述,操作日志内容
		sysLog.setLogContent(syslog.value());
		sysLog.setLogType(syslog.logType());
		
	}

	//请求的方法名
	String className = joinPoint.getTarget().getClass().getName();
	String methodName = signature.getName();
	sysLog.setMethod(className + "." + methodName + "()");
	
	
	//设置操作类型
	if (sysLog.getLogType() == CommonConstant.LOG_TYPE_2) {
		sysLog.setOperateType(getOperateType(methodName, syslog.operateType()));
	}

	//获取request
	HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
	//请求的参数
	sysLog.setRequestParam(getReqestParams(request,joinPoint));

	//设置IP地址
	sysLog.setIp(IPUtils.getIpAddr(request));

	//获取登录用户信息
	LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
	if(sysUser!=null){
		sysLog.setUserid(sysUser.getUsername());
		sysLog.setUsername(sysUser.getRealname());

	}
	//耗时
	sysLog.setCostTime(time);
	sysLog.setCreateTime(new Date());
	//保存系统日志
	sysLogService.save(sysLog);
}