package com.xunmei.system.service.impl;

import com.xunmei.system.domain.SysJob;
import com.xunmei.system.mapper.SysJobMapper;
import com.xunmei.system.service.ISysJobService;
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 SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> implements ISysJobService {

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

    @Override
    public AjaxResult add(SysJob sysJob){
        return success(baseMapper.insert(sysJob));
    }

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

    @Override
    public AjaxResult updateData(SysJob sysJob){
        return success(baseMapper.updateById(sysJob));
    }

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