package com.sunxung.factoring.service.sys.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.sunxung.factoring.component.exception.ValidatorException;
import com.sunxung.factoring.component.util.CodeUtil;
import com.sunxung.factoring.entity.sys.SysOperationLog;
import com.sunxung.factoring.entity.sys.vo.SysOperationLogSearchVo;
import com.sunxung.factoring.mapper.sys.SysOperationLogMapper;
import com.sunxung.factoring.service.sys.ISysOperationLogService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统人员操作日志 服务实现类
 * </p>
 *
 * @author liutao
 * @since 2023-08-08
 */
@Service
public class SysOperationLogServiceImpl extends ServiceImpl<SysOperationLogMapper, SysOperationLog> implements ISysOperationLogService {

    @Override
    public List<SysOperationLog> findBySearch(SysOperationLogSearchVo sysOperationLogSearchVo) {
        Long logInId = sysOperationLogSearchVo.getLogInId();
        if(logInId == null){
            throw new ValidatorException(CodeUtil.FAIL,"登陆日志id不能为空！");
        }
        PageHelper.startPage(sysOperationLogSearchVo.getPage(),sysOperationLogSearchVo.getRows());
        List<SysOperationLog> list = lambdaQuery().eq(SysOperationLog::getSysLoginLogId, logInId).list();
        return list;
    }
}
