class JobsServiceImpl extends SonicServiceImpl<JobsMapper, Jobs> implements JobsService {

    @Autowired
    private QuartzHandler quartzHandler;
    @Autowired
    private JobsMapper jobsMapper;
    private static final String TEST_JOB = "testJob";

    @Override
    @Transactional(rollbackFor = Exception.class)
    public RespModel<String> saveJobs(Jobs jobs) throws SonicException {
        jobs.setStatus(JobStatus.ENABLE);
        jobs.setType(TEST_JOB);
        save(jobs);
        CronTrigger trigger = quartzHandler.getTrigger(jobs);
        try {
            if (trigger != null) {
                quartzHandler.updateScheduleJob(jobs);
            } else {
                quartzHandler.createScheduleJob(jobs);
            }
            return new RespModel<>(RespEnum.HANDLE_OK);
        } catch (RuntimeException | SchedulerException e) {
            e.printStackTrace();
            throw new SonicException("error.cron");
        }
    }

    @Override
    public RespModel<String> updateStatus(int id, int type) {
        if (existsById(id)) {
            try {
                Jobs jobs = findById(id);
                switch (type) {
                    case JobStatus.DISABLE:
                        quartzHandler.pauseScheduleJob(jobs);
                        jobs.setStatus(JobStatus.DISABLE);
                        save(jobs);
                        return new RespModel<>(2000, "job.disable");
                    case JobStatus.ENABLE:
                        quartzHandler.resumeScheduleJob(jobs);
                        jobs.setStatus(JobStatus.ENABLE);
                        save(jobs);
                        return new RespModel<>(2000, "job.enable");
                    case JobStatus.ONCE:
                        quartzHandler.runScheduleJob(jobs);
                        return new RespModel<>(2000, "job.start");
                    default:
                        return new RespModel<>(3000, "job.params.invalid");
                }
            } catch (RuntimeException | SchedulerException e) {
                e.printStackTrace();
                return new RespModel<>(3000, "job.handle.fail");
            }
        } else {
            return new RespModel<>(RespEnum.ID_NOT_FOUND);
        }
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public RespModel<String> delete(int id) {<FILL_FUNCTION_BODY>}

    @Override
    public Page<Jobs> findByProjectId(int projectId, Page<Jobs> pageable) {
        return lambdaQuery()
                .eq(Jobs::getProjectId, projectId)
                .eq(Jobs::getType, TEST_JOB)
                .orderByDesc(Jobs::getId)
                .page(pageable);
    }

    @Override
    public Jobs findById(int id) {
        return lambdaQuery()
                .eq(Jobs::getId, id)
                .eq(Jobs::getType, TEST_JOB)
                .one();
    }

    @Override
    public Jobs findByType(String type) {
        return lambdaQuery()
                .eq(Jobs::getType, type)
                .one();
    }


    @Override
    public void updateSysJob(String type, String cron) {
        Jobs jobs = lambdaQuery()
                .eq(Jobs::getType, type)
                .one();
        if (jobs != null) {
            jobs.setCronExpression(cron);
            save(jobs);
        }

        quartzHandler.updateSysScheduleJob(type, cron);
    }

    @Override
    public List<JSONObject> findSysJobs() {
        return quartzHandler.findSysJobs();
    }
}

        Jobs jobs = baseMapper.selectById(id);
        try {
            quartzHandler.deleteScheduleJob(jobs);
        } catch (SchedulerException e) {
            return new RespModel<>(RespEnum.DELETE_FAIL);
        }
        int count = baseMapper.deleteById(id);
        if (count > 0) {
            return new RespModel<>(RespEnum.DELETE_OK);
        }
        return new RespModel<>(RespEnum.ID_NOT_FOUND);
    
<methods>public non-sealed void <init>() ,public boolean save(org.cloud.sonic.controller.models.domain.Jobs) <variables>