zhongrj
2023-06-03 b112d242575fe96123b1e8dad434f46e6d2bb3d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package cn.gistack.job.executor.service.impl;
 
import cn.gistack.job.executor.entity.XxlJobInfo;
import cn.gistack.job.executor.entity.XxlJobInfoType;
import cn.gistack.job.executor.mapper.XxlJobInfoMapper;
import cn.gistack.job.executor.service.IXxlJobInfoService;
import cn.gistack.job.executor.vo.XxlJobInfoVO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
/**
 * @PROJECT_NAME: skjcmanager
 * @DESCRIPTION:
 * @USER: aix
 * @DATE: 2023/5/15 14:53
 */
@Service
@DS("xxljob")
public class XxlJobInfoServiceImpl extends ServiceImpl<XxlJobInfoMapper, XxlJobInfo> implements IXxlJobInfoService {
 
    /**
     * 自定义新增定时任务
     * @param xxlJobInfo
     * @return
     */
    @Override
    public Object saveXxlJob(XxlJobInfoVO xxlJobInfo) {
        boolean flag = false;
        boolean save = save(xxlJobInfo);
        if (save){
            XxlJobInfoType xxlJobInfoType = new XxlJobInfoType();
            xxlJobInfoType.setXxlJobInfoId(xxlJobInfo.getId());
            xxlJobInfoType.setTypeName(xxlJobInfo.getTypeName());
            // 插入成功则
            Integer insert = baseMapper.insertXxlJobInfoType(xxlJobInfoType);
            if (insert >0){
                flag = true;
            }
        }
        return flag;
    }
 
    /**
     * 自定义修改定时任务
     * @param xxlJobInfo
     * @return
     */
    @Override
    public Object updateXxlJobById(XxlJobInfoVO xxlJobInfo) {
        boolean update = updateById(xxlJobInfo);
        return update;
    }
 
    /**
     * 自定义分页查询定时任务列表信息
     * @param xxlJobInfo
     * @param page
     * @return
     */
    @Override
    public IPage<XxlJobInfoVO> selectXxlJobPage(IPage<XxlJobInfoVO> page, XxlJobInfoVO xxlJobInfo) {
        return page.setRecords(baseMapper.selectXxlJobPage(page,xxlJobInfo));
    }
}