Node增删改查
parent
d19ee1a9ff
commit
b4e68f78de
|
@ -2,8 +2,8 @@ package com.muyu.common.domian;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.domian.req.NodeAddReq;
|
||||
import com.muyu.common.domian.req.NodeUpdReq;
|
||||
import com.muyu.common.domian.req.TaskInputAddReq;
|
||||
import com.muyu.common.domian.req.TaskInputUpdReq;
|
||||
import com.muyu.common.domian.resp.NodeResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -18,8 +18,8 @@ import java.util.function.Supplier;
|
|||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "etl_node" ,autoResultMap = true)
|
||||
public class Node extends BaseEntity {
|
||||
@TableName(value = "etl_task_input" ,autoResultMap = true)
|
||||
public class TaskInput extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
|
@ -70,7 +70,7 @@ public class Node extends BaseEntity {
|
|||
*/
|
||||
private String fieldAsEngineId;
|
||||
|
||||
public static NodeResp build(Node node) {
|
||||
public static NodeResp build(TaskInput node) {
|
||||
return NodeResp.builder()
|
||||
.id(node.id)
|
||||
.nodeId(node.nodeId)
|
||||
|
@ -85,8 +85,8 @@ public class Node extends BaseEntity {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static Node addBuild(NodeAddReq req) {
|
||||
return Node.builder()
|
||||
public static TaskInput addBuild(TaskInputAddReq req) {
|
||||
return TaskInput.builder()
|
||||
.nodeId(req.getNodeId())
|
||||
.nodeName(req.getNodeName())
|
||||
.taskId(req.getTaskId())
|
||||
|
@ -98,8 +98,8 @@ public class Node extends BaseEntity {
|
|||
.fieldAsEngineId(req.getFieldAsEngineId())
|
||||
.build();
|
||||
}
|
||||
public static Node updBuild(NodeUpdReq req, Supplier<Integer> id) {
|
||||
return Node.builder()
|
||||
public static TaskInput updBuild(TaskInputUpdReq req, Supplier<Integer> id) {
|
||||
return TaskInput.builder()
|
||||
.id(id.get())
|
||||
.nodeId(req.getNodeId())
|
||||
.nodeName(req.getNodeName())
|
|
@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "节点添加请求对象" )
|
||||
public class NodeAddReq {
|
||||
public class TaskInputAddReq {
|
||||
|
||||
/**
|
||||
* 节点id
|
|
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "节点列表请求对象" )
|
||||
public class NodeListReq {
|
||||
public class TaskInputListReq {
|
||||
|
||||
/**
|
||||
* 节点名称
|
|
@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "节点添加请求对象" )
|
||||
public class NodeUpdReq {
|
||||
public class TaskInputUpdReq {
|
||||
/**
|
||||
* 节点id
|
||||
*/
|
|
@ -2,11 +2,9 @@ package com.muyu.task.server.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domian.Node;
|
||||
import com.muyu.common.domian.TaskInfo;
|
||||
import com.muyu.common.domian.TaskInput;
|
||||
import com.muyu.common.domian.req.*;
|
||||
import com.muyu.common.domian.resp.NodeResp;
|
||||
import com.muyu.common.domian.resp.TaskInfoResp;
|
||||
import com.muyu.task.server.service.NodeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -28,8 +26,8 @@ public class NodeController {
|
|||
*/
|
||||
@PostMapping("list")
|
||||
@Operation(summary = "查看节点", description = "根据节点名称 权重 状态 查询")
|
||||
public Result list(@RequestBody NodeListReq req) {
|
||||
Page<Node> list = nodeService.findList(req);
|
||||
public Result list(@RequestBody TaskInputListReq req) {
|
||||
Page<TaskInput> list = nodeService.findList(req);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
@ -40,8 +38,8 @@ public class NodeController {
|
|||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "添加节点", description = "添加任务信息表")
|
||||
public Result save(@RequestBody @Validated NodeAddReq req) {
|
||||
nodeService.save(Node.addBuild(req));
|
||||
public Result save(@RequestBody @Validated TaskInputAddReq req) {
|
||||
nodeService.save(TaskInput.addBuild(req));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
@ -53,8 +51,8 @@ public class NodeController {
|
|||
@GetMapping("/{id}")
|
||||
@Operation(summary = "任务信息查询",description = "通过任务id查询任务信息")
|
||||
public Result<NodeResp> selectById(@PathVariable("id") Long id) {
|
||||
Node byId = nodeService.getById(id);
|
||||
return Result.success(Node.build(byId));
|
||||
TaskInput byId = nodeService.getById(id);
|
||||
return Result.success(TaskInput.build(byId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,8 +76,8 @@ public class NodeController {
|
|||
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "任务信息修改",description = "通过任务id修改任务信息")
|
||||
public Result update(@PathVariable("id") Integer id , @RequestBody NodeUpdReq req){
|
||||
nodeService.updateById(Node.updBuild(req,()->id));
|
||||
public Result update(@PathVariable("id") Integer id , @RequestBody TaskInputUpdReq req){
|
||||
nodeService.updateById(TaskInput.updBuild(req,()->id));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.muyu.task.server.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.domian.Node;
|
||||
import com.muyu.common.domian.TaskInput;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface NodeMapper extends BaseMapper<Node> {
|
||||
public interface NodeMapper extends BaseMapper<TaskInput> {
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.muyu.task.server.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.domian.Node;
|
||||
import com.muyu.common.domian.req.NodeListReq;
|
||||
import com.muyu.common.domian.TaskInput;
|
||||
import com.muyu.common.domian.req.TaskInputListReq;
|
||||
|
||||
public interface NodeService extends IService<Node> {
|
||||
Page<Node> findList(NodeListReq req);
|
||||
public interface NodeService extends IService<TaskInput> {
|
||||
Page<TaskInput> findList(TaskInputListReq req);
|
||||
}
|
||||
|
|
|
@ -4,19 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.domian.Node;
|
||||
import com.muyu.common.domian.req.NodeListReq;
|
||||
import com.muyu.common.domian.TaskInput;
|
||||
import com.muyu.common.domian.req.TaskInputListReq;
|
||||
import com.muyu.task.server.mapper.NodeMapper;
|
||||
import com.muyu.task.server.service.NodeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements NodeService {
|
||||
public class NodeServiceImpl extends ServiceImpl<NodeMapper, TaskInput> implements NodeService {
|
||||
@Override
|
||||
public Page<Node> findList(NodeListReq req) {
|
||||
LambdaQueryWrapper<Node> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotEmpty(req.getNodeName()), Node::getNodeName, req.getNodeName());
|
||||
Page<Node> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||
public Page<TaskInput> findList(TaskInputListReq req) {
|
||||
LambdaQueryWrapper<TaskInput> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotEmpty(req.getNodeName()), TaskInput::getNodeName, req.getNodeName());
|
||||
Page<TaskInput> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||
return this.page(page, wrapper);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue