package com.xunmei.system.service.impl;

import com.xunmei.system.domain.Job;
import com.xunmei.system.mapper.JobMapper;
import com.xunmei.system.service.IJobService;
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 luojun
 * @since 2023-08-04
 */
@Service
public class JobServiceImpl extends ServiceImpl<JobMapper, Job> implements IJobService {

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

    @Override
    public AjaxResult add(Job job){
        return success(baseMapper.insert(job));
    }

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

    @Override
    public AjaxResult updateData(Job job){
        return success(baseMapper.updateById(job));
    }

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