添加实体类

master
陈思豪 2024-08-25 09:43:40 +08:00
parent bfc23b6e26
commit 4bacae55ad
10 changed files with 134 additions and 9 deletions

View File

@ -1,5 +1,10 @@
package com.muyu.domain; package com.muyu.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* @PackageName:com.muyu.domain * @PackageName:com.muyu.domain
* @ClassName:aaA * @ClassName:aaA
@ -7,6 +12,10 @@ package com.muyu.domain;
* @author: * @author:
* @date: 2024/8/23 18:53 * @date: 2024/8/23 18:53
*/ */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class Structure { public class Structure {
private Integer id; private Integer id;
private String fieldName; private String fieldName;

View File

@ -41,7 +41,7 @@ public class TaskInputInfo extends BaseEntity {
/** /**
* id * id
*/ */
private Integer databaseId; private String databaseId;
/** /**
* *
@ -56,7 +56,7 @@ public class TaskInputInfo extends BaseEntity {
/** /**
* *
*/ */
private String[] tableField; private String tableField;
/** /**
* *

View File

@ -0,0 +1,32 @@
package com.muyu.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.domain.Structure;
import com.muyu.service.StructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @PackageName:com.muyu.controller
* @ClassName:TextController
* @Description:
* @author:
* @date: 2024/8/24 20:45
*/
@RestController
@RequestMapping("/structure")
public class StructureController {
@Resource
private StructureService structureService;
@GetMapping("/findThis")
public String findThis() {
return structureService.findThis();
}
}

View File

@ -1,6 +1,7 @@
package com.muyu.controller; package com.muyu.controller;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.domain.Structure;
import com.muyu.domain.TaskInfo; import com.muyu.domain.TaskInfo;
import com.muyu.domain.TaskInputInfo; import com.muyu.domain.TaskInputInfo;
import com.muyu.service.TaskInputService; import com.muyu.service.TaskInputService;
@ -28,17 +29,26 @@ public class TaskInputController {
@Autowired @Autowired
private TaskInputService taskInputService; private TaskInputService taskInputService;
@RequestMapping(path = "/list", method = RequestMethod.POST) @RequestMapping(path = "/list", method = RequestMethod.GET)
@Operation(summary = "查看任务节点详情", description = "根据任务的名称或者状态 ,进行模糊查询") @Operation(summary = "查看任务节点详情", description = "根据任务的名称或者状态 ,进行模糊查询")
public Result<List<TaskInputInfo>> selectList( public Result<List<TaskInputInfo>> selectList() {
@Validated @RequestBody TaskInfo taskInfo) {
startPage(); startPage();
List<TaskInputInfo> taskInputInfos = taskInputService.selectList(taskInfo); List<TaskInputInfo> taskInputInfos = taskInputService.selectList();
return Result.success( return Result.success(
taskInputInfos taskInputInfos
); );
} }
@RequestMapping(path = "/findByInputId/{id}", method = RequestMethod.POST)
@Operation(summary = "查看任务节点详情", description = "根据任务的名称或者状态 ,进行模糊查询")
public Result<List<Structure>> findByInputId(@PathVariable(name = "id") Integer id) {
startPage();
List<Structure> taskInputInfo = taskInputService.findByInputId(id);
return Result.success(
taskInputInfo
);
}
// /** // /**
// * 添加新任务 // * 添加新任务

View File

@ -0,0 +1,16 @@
package com.muyu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.Structure;
import org.apache.ibatis.annotations.Mapper;
/**
* @PackageName:com.muyu.mapper
* @ClassName:StructureMapper
* @Description:
* @author:
* @date: 2024/8/24 20:48
*/
@Mapper
public interface StructureMapper extends BaseMapper<Structure> {
}

View File

@ -0,0 +1,9 @@
package com.muyu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.Structure;
public interface StructureService extends IService<Structure> {
String findThis();
}

View File

@ -1,6 +1,7 @@
package com.muyu.service; package com.muyu.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.Structure;
import com.muyu.domain.TaskInfo; import com.muyu.domain.TaskInfo;
import com.muyu.domain.TaskInputInfo; import com.muyu.domain.TaskInputInfo;
@ -14,5 +15,7 @@ import java.util.List;
* @date: 2024/8/22 20:18 * @date: 2024/8/22 20:18
*/ */
public interface TaskInputService extends IService<TaskInputInfo> { public interface TaskInputService extends IService<TaskInputInfo> {
List<TaskInputInfo> selectList(TaskInfo taskInfo); List<TaskInputInfo> selectList();
List<Structure> findByInputId(Integer id);
} }

View File

@ -0,0 +1,34 @@
package com.muyu.service.impl;
import cn.hutool.json.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.domain.Structure;
import com.muyu.domain.TaskInputInfo;
import com.muyu.mapper.StructureMapper;
import com.muyu.mapper.TaskInputInfoMapper;
import com.muyu.service.StructureService;
import com.muyu.service.TaskInputService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @PackageName:com.muyu.service.impl
* @ClassName:StructureServiceImpl
* @Description:
* @author:
* @date: 2024/8/24 20:48
*/
@Service
public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> implements StructureService {
@Override
public String findThis() {
List<Structure> list = this.list();
String jsonString = JSONArray.toJSONString(list);
return jsonString;
}
}

View File

@ -1,9 +1,12 @@
package com.muyu.service.impl; package com.muyu.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.domain.Structure;
import com.muyu.domain.TaskInfo; import com.muyu.domain.TaskInfo;
import com.muyu.domain.TaskInputInfo; import com.muyu.domain.TaskInputInfo;
import com.muyu.mapper.TaskInputInfoMapper; import com.muyu.mapper.TaskInputInfoMapper;
@ -27,8 +30,17 @@ public class TaskInputServiceImpl extends ServiceImpl<TaskInputInfoMapper, TaskI
@Override @Override
public List<TaskInputInfo> selectList(TaskInfo taskInfo) { public List<TaskInputInfo> selectList() {
LambdaQueryWrapper<TaskInputInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TaskInputInfo> queryWrapper = new LambdaQueryWrapper<>();
return this.list(queryWrapper); return this.list(queryWrapper);
} }
@Override
public List<Structure> findByInputId(Integer id) {
LambdaQueryWrapper<TaskInputInfo> queryWrapper = new LambdaQueryWrapper<>();
TaskInputInfo taskInputInfo = this.getOne(queryWrapper);
String tableField = taskInputInfo.getTableField();
List<Structure> structures = JSONArray.parseArray(tableField, Structure.class);
return structures;
}
} }

View File

@ -7,7 +7,7 @@ nacos:
addr: 47.116.184.54:8848 addr: 47.116.184.54:8848
user-name: nacos user-name: nacos
password: nacos password: nacos
namespace: cloud-2112 namespace: text
# Spring # Spring
spring: spring: