名称修改
parent
427541b186
commit
523e80e9b1
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.common.domian.req.TaskInputAddReq;
|
import com.muyu.common.domian.req.InputAddReq;
|
||||||
import com.muyu.common.domian.req.TaskInputUpdReq;
|
import com.muyu.common.domian.req.TaskInputUpdReq;
|
||||||
import com.muyu.common.domian.resp.TaskInputResp;
|
import com.muyu.common.domian.resp.TaskInputResp;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -88,19 +88,6 @@ public class TaskInput extends BaseEntity {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaskInput addBuild(TaskInputAddReq req) {
|
|
||||||
return TaskInput.builder()
|
|
||||||
.nodeId(req.getNodeId())
|
|
||||||
.nodeName(req.getNodeName())
|
|
||||||
.taskId(req.getTaskId())
|
|
||||||
.databaseId(req.getDatabaseId())
|
|
||||||
.tableName(req.getTableName())
|
|
||||||
.tableAsName(req.getTableAsName())
|
|
||||||
.tableFieId(req.getTableFieId())
|
|
||||||
.tableAsFieId(req.getTableAsFieId())
|
|
||||||
.fieIdAsEngineId(req.getFieIdAsEngineId())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
public static TaskInput updBuild(TaskInputUpdReq req, Supplier<Integer> id) {
|
public static TaskInput updBuild(TaskInputUpdReq req, Supplier<Integer> id) {
|
||||||
return TaskInput.builder()
|
return TaskInput.builder()
|
||||||
.id(id.get())
|
.id(id.get())
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package com.muyu.common.domian.req;
|
package com.muyu.common.domian.req;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import com.muyu.common.domian.vo.TableVo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Tag(name = "节点添加请求对象" )
|
public class InputAddReq {
|
||||||
public class TaskInputAddReq {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点id
|
* 节点id
|
||||||
|
@ -42,18 +43,10 @@ public class TaskInputAddReq {
|
||||||
* 表别名
|
* 表别名
|
||||||
*/
|
*/
|
||||||
private String tableAsName;
|
private String tableAsName;
|
||||||
|
/**
|
||||||
|
* 字段
|
||||||
|
*/
|
||||||
|
List<TableVo> list;
|
||||||
|
|
||||||
/**
|
|
||||||
* 表字段
|
|
||||||
*/
|
|
||||||
private String tableFieId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表字段别名
|
|
||||||
*/
|
|
||||||
private String tableAsFieId;
|
|
||||||
/**
|
|
||||||
* 字段规则
|
|
||||||
*/
|
|
||||||
private String fieIdAsEngineId;
|
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.common.domian.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.checkerframework.checker.units.qual.N;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TableVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表字段
|
||||||
|
*/
|
||||||
|
private String tableFieId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表字段别名
|
||||||
|
*/
|
||||||
|
private String tableAsFieId;
|
||||||
|
/**
|
||||||
|
* 字段规则
|
||||||
|
*/
|
||||||
|
private String fieIdAsEngineId;
|
||||||
|
}
|
|
@ -5,11 +5,15 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.domian.TaskInput;
|
import com.muyu.common.domian.TaskInput;
|
||||||
import com.muyu.common.domian.req.*;
|
import com.muyu.common.domian.req.*;
|
||||||
import com.muyu.common.domian.resp.TaskInputResp;
|
import com.muyu.common.domian.resp.TaskInputResp;
|
||||||
|
import com.muyu.common.domian.vo.TableVo;
|
||||||
import com.muyu.task.server.service.TaskInputService;
|
import com.muyu.task.server.service.TaskInputService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
|
@ -19,8 +23,10 @@ public class TaskInputController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskInputService taskInputService;
|
private TaskInputService taskInputService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有的任务信息
|
* 获取所有的任务信息
|
||||||
|
*
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -33,23 +39,40 @@ public class TaskInputController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加节点信息
|
* 添加节点信息
|
||||||
|
*
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
@Operation(summary = "添加节点", description = "添加任务信息表")
|
@Operation(summary = "添加节点", description = "添加任务信息表")
|
||||||
public Result save(@RequestBody @Validated TaskInputAddReq req) {
|
public Result save(@RequestBody @Validated InputAddReq req) {
|
||||||
taskInputService.save(TaskInput.addBuild(req));
|
List<TableVo> list = req.getList();
|
||||||
|
List<TaskInput> inputs = list.stream().map(inputAddReq -> {
|
||||||
|
TaskInput build = TaskInput.builder()
|
||||||
|
.nodeId(req.getNodeId())
|
||||||
|
.nodeName(req.getNodeName())
|
||||||
|
.taskId(req.getTaskId())
|
||||||
|
.databaseId(req.getDatabaseId())
|
||||||
|
.tableName(req.getTableName())
|
||||||
|
.tableAsName(req.getTableAsName())
|
||||||
|
.tableFieId(inputAddReq.getTableFieId())
|
||||||
|
.tableAsFieId(inputAddReq.getTableAsFieId())
|
||||||
|
.fieIdAsEngineId(inputAddReq.getFieIdAsEngineId())
|
||||||
|
.build();
|
||||||
|
return build;
|
||||||
|
}).toList();
|
||||||
|
taskInputService.saveBatch(inputs);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询任务信息
|
* 通过id查询任务信息
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
@Operation(summary = "任务信息查询",description = "通过任务id查询任务信息")
|
@Operation(summary = "任务信息查询", description = "通过任务id查询任务信息")
|
||||||
public Result<TaskInputResp> selectById(@PathVariable("id") Long id) {
|
public Result<TaskInputResp> selectById(@PathVariable("id") Long id) {
|
||||||
TaskInput byId = taskInputService.getById(id);
|
TaskInput byId = taskInputService.getById(id);
|
||||||
return Result.success(TaskInput.build(byId));
|
return Result.success(TaskInput.build(byId));
|
||||||
|
@ -57,28 +80,30 @@ public class TaskInputController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除任务
|
* 通过id删除任务
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@Operation(summary = "删除任务",description = "通过任务id删除任务信息")
|
@Operation(summary = "删除任务", description = "通过任务id删除任务信息")
|
||||||
public Result delete(@PathVariable("id") Long id) {
|
public Result delete(@PathVariable("id") Long id) {
|
||||||
taskInputService.removeById(id);
|
taskInputService.removeById(id);
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null, "操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id修改任务
|
* 通过id修改任务
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@Operation(summary = "任务信息修改",description = "通过任务id修改任务信息")
|
@Operation(summary = "任务信息修改", description = "通过任务id修改任务信息")
|
||||||
public Result update(@PathVariable("id") Integer id , @RequestBody TaskInputUpdReq req){
|
public Result update(@PathVariable("id") Integer id, @RequestBody TaskInputUpdReq req) {
|
||||||
taskInputService.updateById(TaskInput.updBuild(req,()->id));
|
taskInputService.updateById(TaskInput.updBuild(req, () -> id));
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null, "操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue