package com.fdage.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.fdage.dao.base.TbLogMapper;
import com.fdage.dao.cust.TbLogMapperCust;
import com.fdage.pojo.TbLog;
import com.fdage.request.RequestLog;
import com.fdage.service.ILogService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.List;

/**
 * Created by Hb_zzZ on 2020/7/28.
 */
@Slf4j
@Service
public class LogServiceImpl implements ILogService {

    @Autowired
    private TbLogMapper logMapper;

    @Autowired
    private TbLogMapperCust logMapperCust;

    @Override
    public int save(TbLog log) {
        return logMapper.insertSelective(log);
    }

    @Override
    public List<TbLog> findList(RequestLog bo) {
        int pageNum = bo.getPageNum() == 0? 1: bo.getPageNum();
        int pageSize = bo.getPageSize() == 0? 10: bo.getPageSize();
        PageHelper.startPage(pageNum, pageSize);
        return logMapperCust.findList(bo);
    }
}
