添加实体类

master
陈思豪 2024-08-27 14:36:09 +08:00
parent e1fbb067f7
commit 4db14d49a4
5 changed files with 49 additions and 6 deletions

View File

@ -23,7 +23,7 @@ import java.util.List;
@NoArgsConstructor
@SuperBuilder
public class TableInfo extends BaseEntity {
private String id;
private Integer id;
private String basicId;
private String tableName;
private String tableRemark;

View File

@ -0,0 +1,26 @@
package com.muyu.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @PackageName:com.muyu.domain.resp
* @ClassName:TableInfoCasResp
* @Description:
* @author:
* @date: 2024/8/27 14:24
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class TableInfoCasResp {
private Integer value;
private String label;
private List<TableInfoCasResp> children;
}

View File

@ -2,6 +2,7 @@ package com.muyu.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.domain.TableInfo;
import com.muyu.domain.resp.TableInfoCasResp;
import com.muyu.domain.resp.TaskInputInfoResp;
import com.muyu.service.TableInfoService;
import io.swagger.v3.oas.annotations.Operation;
@ -28,9 +29,9 @@ public class TableInfoController {
@RequestMapping(path = "/list", method = RequestMethod.GET)
@Operation(summary = "查看任务节点详情", description = "根据任务的名称或者状态 ,进行模糊查询")
public Result<List<TableInfo>> selectList() {
public Result<List<TableInfoCasResp>> selectList() {
startPage();
List<TableInfo> taskInputInfos = tableInfoService.selectList();
List<TableInfoCasResp> taskInputInfos = tableInfoService.selectList();
return Result.success(
taskInputInfos
);

View File

@ -2,6 +2,7 @@ package com.muyu.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.TableInfo;
import com.muyu.domain.resp.TableInfoCasResp;
import com.muyu.domain.resp.TaskInputInfoResp;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
* @date: 2024/8/22 20:18
*/
public interface TableInfoService extends IService<TableInfo> {
List<TableInfo> selectList();
List<TableInfoCasResp> selectList();
TableInfo findByTableId(Integer id);
}

View File

@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.domain.Structure;
import com.muyu.domain.TableInfo;
import com.muyu.domain.TaskInputInfo;
import com.muyu.domain.resp.TableInfoCasResp;
import com.muyu.domain.resp.TaskInputInfoResp;
import com.muyu.mapper.TableInfoMapper;
import com.muyu.service.TableInfoService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -24,17 +26,30 @@ import java.util.List;
public class TableInfoServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
@Override
public List<TableInfo> selectList() {
public List<TableInfoCasResp> selectList() {
List<TableInfoCasResp> tableInfoCasResp = new ArrayList<>();
LambdaQueryWrapper<TableInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TableInfo::getParentId,0);
List<TableInfo> list = this.list(queryWrapper);
list.forEach(tableInfo -> {
TableInfoCasResp tableInfoCasRespDad = new TableInfoCasResp();
tableInfoCasRespDad.setValue(tableInfo.getId());
tableInfoCasRespDad.setLabel(tableInfo.getTableName());
LambdaQueryWrapper<TableInfo> queryWrapperC = new LambdaQueryWrapper<>();
queryWrapperC.eq(TableInfo::getParentId,tableInfo.getId());
List<TableInfo> list1 = this.list(queryWrapperC);
List<TableInfoCasResp> tableInfoCasRespSon = new ArrayList<>();
for (TableInfo info : list1) {
TableInfoCasResp casResp = new TableInfoCasResp();
casResp.setValue(info.getId());
casResp.setLabel(info.getTableName());
tableInfoCasRespSon.add(casResp);
}
tableInfoCasRespDad.setChildren(tableInfoCasRespSon);
tableInfo.setTableInfoList(list1);
tableInfoCasResp.add(tableInfoCasRespDad);
});
return list;
return tableInfoCasResp;
}
@Override