名称修改
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.TableName;
|
||||
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.resp.TaskInputResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -88,19 +88,6 @@ public class TaskInput extends BaseEntity {
|
|||
.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) {
|
||||
return TaskInput.builder()
|
||||
.id(id.get())
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "节点添加请求对象" )
|
||||
public class TaskInputAddReq {
|
||||
public class InputAddReq {
|
||||
|
||||
/**
|
||||
* 节点id
|
||||
|
@ -42,18 +43,10 @@ public class TaskInputAddReq {
|
|||
* 表别名
|
||||
*/
|
||||
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.req.*;
|
||||
import com.muyu.common.domian.resp.TaskInputResp;
|
||||
import com.muyu.common.domian.vo.TableVo;
|
||||
import com.muyu.task.server.service.TaskInputService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
|
@ -19,8 +23,10 @@ public class TaskInputController {
|
|||
|
||||
@Autowired
|
||||
private TaskInputService taskInputService;
|
||||
|
||||
/**
|
||||
* 获取所有的任务信息
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
|
@ -33,23 +39,40 @@ public class TaskInputController {
|
|||
|
||||
/**
|
||||
* 添加节点信息
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "添加节点", description = "添加任务信息表")
|
||||
public Result save(@RequestBody @Validated TaskInputAddReq req) {
|
||||
taskInputService.save(TaskInput.addBuild(req));
|
||||
public Result save(@RequestBody @Validated InputAddReq 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询任务信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "任务信息查询",description = "通过任务id查询任务信息")
|
||||
@Operation(summary = "任务信息查询", description = "通过任务id查询任务信息")
|
||||
public Result<TaskInputResp> selectById(@PathVariable("id") Long id) {
|
||||
TaskInput byId = taskInputService.getById(id);
|
||||
return Result.success(TaskInput.build(byId));
|
||||
|
@ -57,28 +80,30 @@ public class TaskInputController {
|
|||
|
||||
/**
|
||||
* 通过id删除任务
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除任务",description = "通过任务id删除任务信息")
|
||||
@Operation(summary = "删除任务", description = "通过任务id删除任务信息")
|
||||
public Result delete(@PathVariable("id") Long id) {
|
||||
taskInputService.removeById(id);
|
||||
return Result.success(null,"操作成功");
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id修改任务
|
||||
*
|
||||
* @param id
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "任务信息修改",description = "通过任务id修改任务信息")
|
||||
public Result update(@PathVariable("id") Integer id , @RequestBody TaskInputUpdReq req){
|
||||
taskInputService.updateById(TaskInput.updBuild(req,()->id));
|
||||
return Result.success(null,"操作成功");
|
||||
@Operation(summary = "任务信息修改", description = "通过任务id修改任务信息")
|
||||
public Result update(@PathVariable("id") Integer id, @RequestBody TaskInputUpdReq req) {
|
||||
taskInputService.updateById(TaskInput.updBuild(req, () -> id));
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue