package com.sdut.labex.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdut.labex.entity.LogEntity;
import com.sdut.labex.mapper.LogMapper;
import com.sdut.labex.service.LogService;
import com.sdut.labex.utils.ResVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author springforest
 * @description 针对表【log(日志)】的数据库操作Service实现
 * @createDate 2023-06-21 08:49:57
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, LogEntity>
        implements LogService {
    @Resource
    private LogMapper logMapper;


    @Override
    public ResVo getLog(int pageNum, int pageSize) {
        Page<LogEntity> page = new Page<>(pageNum, pageSize);
        logMapper.selectPage(page, null);

        Map<String, Object> map = new HashMap<>();
        map.put("total", page.getTotal());
        map.put("list", page.getRecords());
        return ResVo.ok(map);
    }
}




