mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-07-03 21:08:58 +08:00
add: 1.增加插件表和作业表的接口
change: 1. 调整生成临时文件的文件名
This commit is contained in:
parent
599f76edf4
commit
62b292f302
@ -254,7 +254,7 @@ public class Engine {
|
||||
// todo 都是用同一个文件,是否需要考虑线程安全问题
|
||||
// 需要做成异步的,否则前端会一直loading等待完成作业
|
||||
public static void startJobByJsonStr(String jobJson) {
|
||||
String tmpFilePath = "jobTmp.conf-"+ System.currentTimeMillis();
|
||||
final String tmpFilePath = "jobTmp-"+System.currentTimeMillis()+".conf";
|
||||
// 根据json写入到临时本地文件
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
@ -287,7 +287,7 @@ public class Engine {
|
||||
|
||||
}
|
||||
//删除临时文件
|
||||
FileUtil.del(new File("jobTmp.conf"));
|
||||
FileUtil.del(new File(tmpFilePath));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,3 +40,22 @@ INSERT INTO `datax_plugin` VALUES (4, 'writer', 'mysqlwriter', NULL, 'myysql写'
|
||||
INSERT INTO `datax_plugin` VALUES (5, 'reader', 'oraclereader', NULL, 'oracle读取');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for datax_job_config
|
||||
-- ----------------------------
|
||||
create table job_config
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
user_id int null,
|
||||
config varchar(5000) null,
|
||||
create_date timestamp null ,
|
||||
create_by int null,
|
||||
update_by int null,
|
||||
update_date timestamp null,
|
||||
status int(1) default 1 null
|
||||
)comment 'datax插件信息';
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
package com.wugui.dataxweb.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiController;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wugui.dataxweb.entity.DataxPlugin;
|
||||
import com.wugui.dataxweb.service.DataxPluginService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* datax插件信息表控制层
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("dataxPlugin")
|
||||
@Api(tags = "datax插件信息表控制层")
|
||||
public class DataxPluginController extends ApiController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private DataxPluginService dataxPluginService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param dataxPlugin 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询所有数据")
|
||||
public R<IPage<DataxPlugin>> selectAll(Page<DataxPlugin> page, DataxPlugin dataxPlugin) {
|
||||
return success(this.dataxPluginService.page(page, new QueryWrapper<>(dataxPlugin)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation("通过主键查询单条数据")
|
||||
@GetMapping("{id}")
|
||||
public R<DataxPlugin> selectOne(@PathVariable Serializable id) {
|
||||
return success(this.dataxPluginService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param dataxPlugin 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation("新增数据")
|
||||
@PostMapping
|
||||
public R<Boolean> insert(@RequestBody DataxPlugin dataxPlugin) {
|
||||
return success(this.dataxPluginService.save(dataxPlugin));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param dataxPlugin 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
@ApiOperation("修改数据")
|
||||
public R<Boolean> update(@RequestBody DataxPlugin dataxPlugin) {
|
||||
return success(this.dataxPluginService.updateById(dataxPlugin));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除数据")
|
||||
public R<Boolean> delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.dataxPluginService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.wugui.dataxweb.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiController;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
import com.wugui.dataxweb.service.JobConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作业配置表控制层
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("jobConfig")
|
||||
@Api(tags = "作业配置表控制层")
|
||||
public class JobConfigController extends ApiController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private JobConfigService jobConfigServiceImpl;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jobConfig 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询所有数据")
|
||||
public R selectAll(Page<JobConfig> page, JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.page(page, new QueryWrapper<>(jobConfig)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation("通过主键查询单条数据")
|
||||
@GetMapping("{id}")
|
||||
public R<JobConfig> selectOne(@PathVariable Serializable id) {
|
||||
return success(this.jobConfigServiceImpl.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param jobConfig 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation("新增数据")
|
||||
@PostMapping
|
||||
public R<Boolean> insert(@RequestBody JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.save(jobConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param jobConfig 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.updateById(jobConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation("删除数据")
|
||||
@DeleteMapping
|
||||
public R<Boolean> delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.jobConfigServiceImpl.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.wugui.dataxweb.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wugui.dataxweb.entity.DataxPlugin;
|
||||
|
||||
/**
|
||||
* datax插件信息表数据库访问层
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
public interface DataxPluginDao extends BaseMapper<DataxPlugin> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.wugui.dataxweb.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* datax插件信息表实体类
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DataxPlugin extends Model<DataxPlugin> {
|
||||
|
||||
private Integer id;
|
||||
//插件类型,reader writer
|
||||
private String pluginType;
|
||||
//插件名,用作主键
|
||||
private String pluginName;
|
||||
//json模板
|
||||
private String templateJson;
|
||||
//注释
|
||||
private String comments;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPluginType() {
|
||||
return pluginType;
|
||||
}
|
||||
|
||||
public void setPluginType(String pluginType) {
|
||||
this.pluginType = pluginType;
|
||||
}
|
||||
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
public void setPluginName(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
public String getTemplateJson() {
|
||||
return templateJson;
|
||||
}
|
||||
|
||||
public void setTemplateJson(String templateJson) {
|
||||
this.templateJson = templateJson;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.wugui.dataxweb.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -17,6 +18,7 @@ public class JobConfig {
|
||||
private String config;
|
||||
|
||||
@TableField(value = "CREATE_DATE")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createDate;
|
||||
|
||||
@TableField(value = "CREATE_BY")
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.wugui.dataxweb.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wugui.dataxweb.entity.DataxPlugin;
|
||||
|
||||
/**
|
||||
* datax插件信息表服务接口
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
public interface DataxPluginService extends IService<DataxPlugin> {
|
||||
|
||||
}
|
||||
@ -1,10 +1,14 @@
|
||||
package com.wugui.dataxweb.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wugui.dataxweb.dao.JobConfigMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class JobConfigService extends ServiceImpl<JobConfigMapper, JobConfig>{
|
||||
|
||||
}
|
||||
/**
|
||||
* datax插件信息表服务接口
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
public interface JobConfigService extends IService<JobConfig> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.wugui.dataxweb.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wugui.dataxweb.dao.DataxPluginDao;
|
||||
import com.wugui.dataxweb.entity.DataxPlugin;
|
||||
import com.wugui.dataxweb.service.DataxPluginService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* datax插件信息表服务实现类
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* @version v1.0
|
||||
*/
|
||||
@Service("dataxPluginService")
|
||||
public class DataxPluginServiceImpl extends ServiceImpl<DataxPluginDao, DataxPlugin> implements DataxPluginService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.wugui.dataxweb.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wugui.dataxweb.dao.JobConfigMapper;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
import com.wugui.dataxweb.service.JobConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class JobConfigServiceImpl extends ServiceImpl<JobConfigMapper, JobConfig> implements JobConfigService {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user