update
This commit is contained in:
parent
c639590744
commit
c674440585
@ -34,6 +34,11 @@ public class ScheduleJobEntity implements Serializable {
|
||||
*/
|
||||
private String jobName;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String jobType;
|
||||
|
||||
/**
|
||||
* bean名称
|
||||
*/
|
||||
|
@ -1,10 +1,12 @@
|
||||
package cn.datax.service.data.quality.controller;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
|
||||
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
|
||||
import cn.datax.service.data.quality.api.query.ScheduleJobQuery;
|
||||
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
|
||||
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
|
||||
import cn.datax.service.data.quality.service.ScheduleJobService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -15,10 +17,9 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -74,6 +75,61 @@ public class ScheduleJobController extends BaseController {
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param scheduleJob
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据checkRule对象添加信息")
|
||||
@ApiImplicitParam(name = "scheduleJob", value = "详细实体scheduleJob", required = true, dataType = "scheduleJob")
|
||||
@PostMapping()
|
||||
public R saveScheduleJob(@RequestBody @Validated({ValidationGroups.Insert.class}) ScheduleJobEntity scheduleJob) {
|
||||
ScheduleJobEntity scheduleJobEntity = scheduleJobService.saveScheduleJob(scheduleJob);
|
||||
return R.ok().setData(scheduleJobEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param scheduleJob
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "scheduleJob", value = "详细实体scheduleJob", required = true, dataType = "scheduleJob")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateScheduleJob(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ScheduleJobEntity scheduleJob) {
|
||||
ScheduleJobEntity scheduleJobEntity = scheduleJobService.updateScheduleJob(scheduleJob);
|
||||
return R.ok().setData(scheduleJobEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteScheduleJobById(@PathVariable String id) {
|
||||
scheduleJobService.deleteScheduleJobById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteCheckRuleBatch(@PathVariable List<String> ids) {
|
||||
scheduleJobService.deleteScheduleJobBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
* @param id
|
||||
|
@ -1,8 +1,12 @@
|
||||
package cn.datax.service.data.quality.service;
|
||||
|
||||
import cn.datax.service.data.quality.api.dto.CheckRuleDto;
|
||||
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
|
||||
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据质量监控任务信息表 服务类
|
||||
@ -15,6 +19,14 @@ public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
|
||||
|
||||
ScheduleJobEntity getScheduleJobById(String id);
|
||||
|
||||
ScheduleJobEntity saveScheduleJob(ScheduleJobEntity scheduleJob);
|
||||
|
||||
ScheduleJobEntity updateScheduleJob(ScheduleJobEntity scheduleJob);
|
||||
|
||||
void deleteScheduleJobById(String id);
|
||||
|
||||
void deleteScheduleJobBatch(List<String> ids);
|
||||
|
||||
void pauseScheduleJobById(String id);
|
||||
|
||||
void resumeScheduleJobById(String id);
|
||||
|
@ -1,19 +1,22 @@
|
||||
package cn.datax.service.data.quality.service.impl;
|
||||
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
|
||||
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
|
||||
import cn.datax.service.data.quality.dao.ScheduleJobDao;
|
||||
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
|
||||
import cn.datax.service.data.quality.schedule.CronTaskRegistrar;
|
||||
import cn.datax.service.data.quality.schedule.SchedulingRunnable;
|
||||
import cn.datax.service.data.quality.service.ScheduleJobService;
|
||||
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
|
||||
import cn.datax.service.data.quality.dao.ScheduleJobDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据质量监控任务信息表 服务实现类
|
||||
@ -29,6 +32,9 @@ public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, Sche
|
||||
@Autowired
|
||||
private ScheduleJobDao scheduleJobDao;
|
||||
|
||||
@Autowired
|
||||
private ScheduleJobMapper scheduleJobMapper;
|
||||
|
||||
@Autowired
|
||||
private CronTaskRegistrar cronTaskRegistrar;
|
||||
|
||||
@ -38,6 +44,32 @@ public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, Sche
|
||||
return scheduleJobEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ScheduleJobEntity saveScheduleJob(ScheduleJobEntity scheduleJob) {
|
||||
scheduleJobDao.insert(scheduleJob);
|
||||
return scheduleJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ScheduleJobEntity updateScheduleJob(ScheduleJobEntity scheduleJob) {
|
||||
scheduleJobDao.updateById(scheduleJob);
|
||||
return scheduleJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteScheduleJobById(String id) {
|
||||
scheduleJobDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteScheduleJobBatch(List<String> ids) {
|
||||
scheduleJobDao.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseScheduleJobById(String id) {
|
||||
ScheduleJobEntity scheduleJobEntity = super.getById(id);
|
||||
|
@ -7,6 +7,7 @@
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="job_name" property="jobName" />
|
||||
<result column="job_type" property="jobType" />
|
||||
<result column="bean_name" property="beanName" />
|
||||
<result column="method_name" property="methodName" />
|
||||
<result column="method_params" property="methodParams" />
|
||||
@ -17,7 +18,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
job_name, bean_name, method_name, method_params, cron_expression
|
||||
job_name, job_type, bean_name, method_name, method_params, cron_expression
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
x
Reference in New Issue
Block a user