package com.jiayue.insu.inclientqn.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.insu.inclientqn.constant.CommonStant;
import com.jiayue.insu.inclientqn.entity.QuartzBase;
import com.jiayue.insu.inclientqn.mapper.QuartzBaseMapper;
import com.jiayue.insu.inclientqn.service.QuartzBaseService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * 定时任务初始业务实现
 *
 * @author yh
 * @version 1.0
 * @since 2022/5/22 11:29
 */
@Service
public class QuartzBaseServiceImpl extends ServiceImpl<QuartzBaseMapper, QuartzBase> implements QuartzBaseService {


    /**
     * 通过执行类查询
     * @param executeClass 执行类路径
     * @return 结果
     */
    @Override
    public QuartzBase findByExecuteClass(String executeClass) {
        LambdaQueryWrapper<QuartzBase> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(QuartzBase::getExecuteClass,executeClass);
        return this.getOne(lambdaQueryWrapper);
    }


    /**
     * 通过定时任务编码查询
     * @param code 定时任务编码
     * @return 结果
     */
    @Override
    public QuartzBase findByCode(String code) {
        LambdaQueryWrapper<QuartzBase> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(QuartzBase::getCode,code);
        return this.getOne(lambdaQueryWrapper);
    }


}
