package com.ruoyi.common.core.service.impl;

import com.easy.mongodb.core.biz.PageInfo;
import com.easy.mongodb.core.conditions.Wrapper;
import com.ruoyi.common.core.domain.entity.SysOperLog;
import com.ruoyi.common.core.mapper.SysOperLogMapper;
import com.ruoyi.common.core.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 操作日志 服务层处理
 *
 * @author ruoyi
 */
@Service
public class SysOperLogServiceImpl implements ISysOperLogService {
    @Autowired
    private SysOperLogMapper operLogMapper;

    /**
     * 新增操作日志
     *
     * @param operLog 操作日志对象
     */
    @Override
    public void insertOperlog(SysOperLog operLog) {
        this.operLogMapper.insert(operLog);
    }

    /**
     * 查询系统操作日志集合
     *
     * @param operLog 操作日志对象
     * @return 操作日志集合
     */
    @Override
    public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
        return this.operLogMapper.selectList(operLog);
    }

    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    @Override
    public int deleteOperLogByIds(String[] operIds) {
        return this.operLogMapper.deleteBatchIds(Arrays.asList(operIds)).intValue();
    }

    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    @Override
    public SysOperLog selectOperLogById(String operId) {
        return this.operLogMapper.selectById(operId);
    }

    /**
     * 清空操作日志
     */
    @Override
    public void cleanOperLog() {
        this.operLogMapper.drop();
    }

    @Override
    public PageInfo<SysOperLog> page(Wrapper<SysOperLog> wrapper, Integer pageNum, Integer pageSize) {
        return this.operLogMapper.page(wrapper, pageNum, pageSize);
    }
}
