datax模块
commit
9a87945282
|
@ -0,0 +1,21 @@
|
|||
package net.srt;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @ClassName StuApp
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class DataxApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataxApp.class);
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package net.srt.datax.controllor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.datax.server.DataxService;
|
||||
import net.srt.datax.vo.StrDatax;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName StuController
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data")
|
||||
@Tag(name = "datax库表")
|
||||
@AllArgsConstructor
|
||||
public class DataxController {
|
||||
@Autowired
|
||||
private DataxService stuService;
|
||||
|
||||
@Operation(summary = "执行同步")
|
||||
@PostMapping("/json/{id}")
|
||||
public Result json(@PathVariable Long id) {
|
||||
stuService.json(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询列表")
|
||||
@PostMapping("/dataxList")
|
||||
public Result<List<StrDatax>> stuList() {
|
||||
List<StrDatax> stuList = stuService.dataxList();
|
||||
return Result.ok(stuList);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/addDatax")
|
||||
public Result<StrDatax> add(@RequestBody StrDatax strDatax) {
|
||||
stuService.add(strDatax);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改列表")
|
||||
@PostMapping("/updateDatax")
|
||||
public Result<StrDatax> updateDatax(@RequestBody StrDatax strDatax) {
|
||||
stuService.updateDatax(strDatax);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除列表")
|
||||
@PostMapping("/delStudent/{id}")
|
||||
public Result<String> delDatax(@PathVariable Long id) {
|
||||
stuService.delDatax(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "回显")
|
||||
@PostMapping("/findById/{id}")
|
||||
public Result<StrDatax> findById(@PathVariable Integer id) {
|
||||
if (id!= null) {
|
||||
return Result.ok(stuService.findById(id));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.srt.datax.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.srt.datax.vo.StrDatax;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName StuMapper
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataxMapper extends BaseMapper<StrDatax> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.srt.datax.server;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.srt.datax.vo.StrDatax;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName StuService
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
public interface DataxService extends IService<StrDatax> {
|
||||
|
||||
|
||||
|
||||
void add(StrDatax strDatax);
|
||||
|
||||
void delDatax(Long id);
|
||||
|
||||
void updateDatax(StrDatax strDatax);
|
||||
|
||||
StrDatax findById(Integer id);
|
||||
|
||||
void json(Long id);
|
||||
|
||||
List<StrDatax> dataxList();
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package net.srt.datax.server.impl;
|
||||
|
||||
import com.alibaba.datax.core.Engine;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.datax.mapper.DataxMapper;
|
||||
import net.srt.datax.server.DataxService;
|
||||
import net.srt.datax.vo.StrDatax;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* @ClassName StuServiceImpl
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DataxServiceImpl extends BaseServiceImpl<DataxMapper, StrDatax> implements DataxService {
|
||||
|
||||
@Autowired
|
||||
private DataxMapper stuMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void add(StrDatax strDatax) {
|
||||
stuMapper.insert(strDatax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StrDatax> dataxList() {
|
||||
List<StrDatax> selectList = stuMapper.selectList(null);
|
||||
return selectList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delDatax(Long id) {
|
||||
stuMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDatax(StrDatax strDatax) {
|
||||
stuMapper.updateById(strDatax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrDatax findById(Integer id) {
|
||||
StrDatax strDatax = stuMapper.selectById(id);
|
||||
return strDatax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void json(Long id) {
|
||||
StrDatax strDatax = stuMapper.selectById(id);
|
||||
// String[] dataxArgs = {"-job", dataxHome + "/job/" + jobConfig, "-mode", "standalone", "-jobid", "-1"};
|
||||
try {
|
||||
// Engine.entry(dataxArgs);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue