Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / SyslogService.java
package com.newfiber.api.pc.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.newfiber.api.core.bean.SysLog;
import com.newfiber.api.pc.dao.Log.SysLogDao;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by XuChengChao on 2018/12/19.
 */
@Service
public class SyslogService {

    @Autowired
    private SysLogDao sysLogDao;

    public int insert(SysLog sysLog){

        return sysLogDao.insert(sysLog);

    }

    public Page<SysLog>  getLogs(int type, int pageNo, int pageSize, Date st, Date et){
        Page<SysLog> page = new Page<>(pageNo,pageSize);
        Integer startPage = (pageNo-1)*pageSize;
        Integer size = pageSize;
        int total = sysLogDao.getLogInfos(type,st,et,null,null).size();
        List<SysLog> logList = sysLogDao.getLogInfos(type,st,et,startPage,size);
        page.setRecords(logList);
        page.setTotal(total);
        return page;
    }

}