package com.xunmei.system.service.impl;

import com.xunmei.system.domain.OperLog;
import com.xunmei.system.mapper.OperLogMapper;
import com.xunmei.system.service.IOperLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.xunmei.common.core.web.domain.AjaxResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import static com.xunmei.common.core.web.domain.AjaxResult.success;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 操作日志记录 服务实现类
 * </p>
 *
 * @author gaoxiong
 * @since 2023-08-04
 */
@Service
public class OperLogServiceImpl extends ServiceImpl<OperLogMapper, OperLog> implements IOperLogService {

    @Override
    public AjaxResult findListByPage(Page<OperLog> page,OperLog operLog){
    QueryWrapper<OperLog> where = new QueryWrapper<>(operLog);
        return success(baseMapper.selectPage(page,where));
    }

    @Override
    public AjaxResult add(OperLog operLog){
        return success(baseMapper.insert(operLog));
    }

    @Override
    public AjaxResult delete(Long id){
        return success(baseMapper.deleteById(id));
    }

    @Override
    public AjaxResult updateData(OperLog operLog){
        return success(baseMapper.updateById(operLog));
    }

    @Override
    public AjaxResult findById(Long id){
        return success(baseMapper.selectById(id));
    }
}
