package com.ruoyi.cwgl.service.impl;
|
|
import java.util.List;
|
|
import com.ruoyi.common.utils.DateUtils;
|
import javax.annotation.Resource;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.stereotype.Service;
|
import org.springframework.scheduling.annotation.Async;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.annotation.DataSource;
|
import com.ruoyi.common.enums.DataSourceType;
|
import com.ruoyi.common.core.service.BaseService;
|
|
import com.ruoyi.cwgl.mapper.RequestLogMapper;
|
import com.ruoyi.cwgl.domain.RequestLog;
|
import com.ruoyi.cwgl.service.IRequestLogService;
|
import com.ruoyi.common.core.text.Convert;
|
|
/**
|
* 请求日志Service业务层处理
|
*
|
* @author ruoyi
|
* @date 2025-08-27
|
*/
|
@Service
|
@Transactional(rollbackFor = Exception.class)
|
public class RequestLogServiceImpl extends BaseService<RequestLogMapper, RequestLog> implements IRequestLogService
|
{
|
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
@Resource
|
private RequestLogMapper requestLogMapper;
|
|
|
/**
|
* 查询请求日志
|
*
|
* @param id 请求日志ID
|
* @return 请求日志
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public RequestLog selectRequestLogById(Integer id)
|
{
|
return requestLogMapper.selectRequestLogById(id);
|
}
|
|
/**
|
* 查询请求日志 记录数
|
*
|
* @param requestLog 请求日志
|
* @return 请求日志集合
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public int selectRequestLogCount(RequestLog requestLog)
|
{
|
return requestLogMapper.selectRequestLogCount(requestLog);
|
}
|
|
/**
|
* 查询请求日志列表
|
*
|
* @param requestLog 请求日志
|
* @return 请求日志
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Override
|
public List<RequestLog> selectRequestLogList(RequestLog requestLog)
|
{
|
return requestLogMapper.selectRequestLogList(requestLog);
|
}
|
|
/**
|
* 查询请求日志列表 异步 导出
|
*
|
* @param requestLog 请求日志
|
* @param exportKey 导出功能的唯一标识
|
* @return 请求日志集合
|
*/
|
@DataSource(DataSourceType.SLAVE)
|
@Async
|
@Override
|
public void export(RequestLog requestLog,String exportKey) {
|
|
super.export(RequestLog.class,exportKey,"requestLogData",(pageNum)->{
|
PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE);
|
return selectRequestLogList(requestLog);
|
});
|
}
|
|
|
/**
|
* 新增请求日志
|
*
|
* @param requestLog 请求日志
|
* @return 结果
|
*/
|
@Override
|
public int insertRequestLog(RequestLog requestLog)
|
{
|
requestLog.setCreateTime(DateUtils.getNowDate());
|
return requestLogMapper.insertRequestLog(requestLog);
|
}
|
|
/**
|
* 新增请求日志[批量]
|
*
|
* @param requestLogs 请求日志
|
* @return 结果
|
*/
|
@Override
|
public int insertRequestLogBatch(List<RequestLog> requestLogs)
|
{
|
int rows = requestLogMapper.insertRequestLogBatch(requestLogs);
|
return rows;
|
}
|
|
/**
|
* 修改请求日志
|
*
|
* @param requestLog 请求日志
|
* @return 结果
|
*/
|
@Override
|
public int updateRequestLog(RequestLog requestLog)
|
{
|
return requestLogMapper.updateRequestLog(requestLog);
|
}
|
|
/**
|
* 修改请求日志[批量]
|
*
|
* @param requestLogs 请求日志
|
* @return 结果
|
*/
|
@Override
|
public int updateRequestLogBatch(List<RequestLog> requestLogs){
|
return requestLogMapper.updateRequestLogBatch(requestLogs);
|
}
|
|
/**
|
* 删除请求日志对象
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteRequestLogByIds(String ids)
|
{
|
return deleteRequestLogByIds(Convert.toIntArray(ids));
|
}
|
|
/**
|
* 删除请求日志对象
|
*
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteRequestLogByIds(Integer[] ids)
|
{
|
return requestLogMapper.deleteRequestLogByIds(ids);
|
}
|
|
/**
|
* 删除请求日志信息
|
*
|
* @param id 请求日志ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteRequestLogById(Integer id)
|
{
|
return requestLogMapper.deleteRequestLogById(id);
|
}
|
}
|