| | |
| | | package cn.gistack.sm.xxljob.service.impl; |
| | | |
| | | import cn.gistack.sm.xxljob.entity.XxlJobInfo; |
| | | import cn.gistack.sm.xxljob.entity.XxlJobInfoType; |
| | | import cn.gistack.sm.xxljob.mapper.XxlJobInfoMapper; |
| | | import cn.gistack.sm.xxljob.service.IXxlJobInfoService; |
| | | import cn.gistack.sm.xxljob.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; |
| | | |
| | |
| | | @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)); |
| | | } |
| | | } |