package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AccessRecordMapper;
import com.ruoyi.system.domain.AccessRecord;
import com.ruoyi.system.service.IAccessRecordService;

/**
 * 访问记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-27
 */
@Service
public class AccessRecordServiceImpl implements IAccessRecordService 
{
    @Autowired
    private AccessRecordMapper accessRecordMapper;

    /**
     * 查询访问记录
     * 
     * @param recordId 访问记录主键
     * @return 访问记录
     */
    @Override
    public AccessRecord selectAccessRecordByRecordId(Long recordId)
    {
        return accessRecordMapper.selectAccessRecordByRecordId(recordId);
    }

    /**
     * 查询访问记录列表
     * 
     * @param accessRecord 访问记录
     * @return 访问记录
     */
    @Override
    public List<AccessRecord> selectAccessRecordList(AccessRecord accessRecord)
    {
        return accessRecordMapper.selectAccessRecordList(accessRecord);
    }

    /**
     * 新增访问记录
     * 
     * @param accessRecord 访问记录
     * @return 结果
     */
    @Override
    public int insertAccessRecord(AccessRecord accessRecord)
    {
        accessRecord.setCreateTime(DateUtils.getNowDate());
        return accessRecordMapper.insertAccessRecord(accessRecord);
    }

    /**
     * 修改访问记录
     * 
     * @param accessRecord 访问记录
     * @return 结果
     */
    @Override
    public int updateAccessRecord(AccessRecord accessRecord)
    {
        accessRecord.setUpdateTime(DateUtils.getNowDate());
        return accessRecordMapper.updateAccessRecord(accessRecord);
    }

    /**
     * 批量删除访问记录
     * 
     * @param recordIds 需要删除的访问记录主键
     * @return 结果
     */
    @Override
    public int deleteAccessRecordByRecordIds(Long[] recordIds)
    {
        return accessRecordMapper.deleteAccessRecordByRecordIds(recordIds);
    }

    /**
     * 删除访问记录信息
     * 
     * @param recordId 访问记录主键
     * @return 结果
     */
    @Override
    public int deleteAccessRecordByRecordId(Long recordId)
    {
        return accessRecordMapper.deleteAccessRecordByRecordId(recordId);
    }
}
