From 606a05d68eda0503faad4e1cc425f8ba1d178728 Mon Sep 17 00:00:00 2001 From: Saisai Liu <1374434128@qq.com> Date: Tue, 23 Apr 2024 20:41:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/resp/TableInfoStructureResp.java | 55 +++++++++++++++++++ .../muyu/etl/domain/resp/TableTreeResp.java | 2 +- .../impl/BasicConfigInfoServiceImpl.java | 34 +++++++----- 3 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableInfoStructureResp.java diff --git a/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableInfoStructureResp.java b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableInfoStructureResp.java new file mode 100644 index 0000000..96f9932 --- /dev/null +++ b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableInfoStructureResp.java @@ -0,0 +1,55 @@ +package com.muyu.etl.domain.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.muyu.common.core.annotation.Excel; +import com.muyu.etl.domain.Structure; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.util.List; + +/** + * 库表基础信息对象 table_info + * + * @author Saisai + * @date 2024-04-22 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@SuperBuilder +public class TableInfoStructureResp +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long basicId; + + /** 表名称/数据库 */ + @Excel(name = "表名称/数据库") + private String tableName; + + /** 表备注 */ + @Excel(name = "表备注") + private String tableRemark; + + /** 数据量 */ + @Excel(name = "数据量") + private Long dataNum; + + /** 是否核心 'Y'是 'N'不是 */ + @Excel(name = "是否核心 'Y'是 'N'不是") + private String center; + private String databaseType; + + private List structureList; + +} diff --git a/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableTreeResp.java b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableTreeResp.java index ccecaed..78c9cbb 100644 --- a/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableTreeResp.java +++ b/muyu-modules/muyv-etl/muyu-etl-common/src/main/java/com/muyu/etl/domain/resp/TableTreeResp.java @@ -35,5 +35,5 @@ public class TableTreeResp { /** * 子级信息 */ - private List Children; + private List Children; } diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java index ad1df80..91230e9 100644 --- a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java @@ -1,11 +1,13 @@ package com.muyu.etl.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.common.security.utils.SecurityUtils; import com.muyu.etl.domain.BasicConfigInfo; import com.muyu.etl.domain.Structure; import com.muyu.etl.domain.TableInfo; +import com.muyu.etl.domain.resp.TableInfoStructureResp; import com.muyu.etl.domain.resp.TableTreeResp; import com.muyu.etl.mapper.BasicConfigInfoMapper; import com.muyu.etl.service.BasicConfigInfoService; @@ -196,7 +198,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl(){{ eq(Structure::getTableId,build.getTableId()); eq(Structure::getColumnName,build.getColumnName()); - eq(Structure::getRemark,build.getRemark()); + eq(Structure::getColumnRemark,build.getColumnRemark()); }}); } } @@ -308,22 +308,28 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl getTableTree() { List tableTreeRespList = tableInfoService.selectTableInfoList(new TableInfo(){{setParentId(0L);}}).stream().map(tableInfo ->{ BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId()); - List tableInfoList = tableInfoService.selectTableInfoList(new TableInfo() {{ + List tableInfoStructureRespList = tableInfoService.selectTableInfoList(new TableInfo() {{ setParentId(tableInfo.getId()); - }}); + }}).stream().map(info -> { + List structureList = structureService.list(new LambdaQueryWrapper().eq(Structure::getTableId,info.getId())); + return TableInfoStructureResp.builder() + .id(info.getId()) + .tableName(info.getTableName()) + .center(info.getCenter()) + .tableRemark(info.getTableRemark()) + .dataNum(info.getDataNum()) + .databaseType(basicConfigInfo.getDatabaseType()) + .structureList(structureList) + .basicId(info.getBasicId()) + .build(); + }).collect(Collectors.toList()); return TableTreeResp.builder() .tableInfo(tableInfo) .basicConfigInfo(basicConfigInfo) - .Children(tableInfoList) + .Children(tableInfoStructureRespList) .build(); }).collect(Collectors.toList()); return tableTreeRespList; } - //{ - // label: '一级 1', - // children: [{ - // label: '二级 1-1', - // data - // }] - // } + }