From 006ecfdc92a7980ee2dc1f64ee568e102f5afa52 Mon Sep 17 00:00:00 2001 From: Yunfei Du <278774021@qq.com> Date: Thu, 9 May 2024 21:04:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=85=A5(?= =?UTF-8?q?=E4=BC=98=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/config/DataAccessClientConfig.java | 19 +++ .../client/config/DataAccessClientRunner.java | 22 +++ .../java/com/etl/data/domain/DataAsset.java | 6 +- .../java/com/etl/data/domain/DataSource.java | 93 ++++++------- .../decoration/DataSourceDecoration.java | 56 ++++++++ .../data/domain/req/DataSourceQueryReq.java | 7 +- .../etl/data/domain/resp/DataSourceResp.java | 127 ----------------- .../data/controller/DataAssetController.java | 3 + .../data/controller/DataSourceController.java | 31 ++--- .../etl/data/service/DataSourceService.java | 6 +- .../service/impl/DataSourceServiceImpl.java | 128 +++++++----------- 11 files changed, 218 insertions(+), 280 deletions(-) create mode 100644 etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientConfig.java create mode 100644 etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientRunner.java create mode 100644 etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/decoration/DataSourceDecoration.java delete mode 100644 etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/resp/DataSourceResp.java diff --git a/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientConfig.java b/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientConfig.java new file mode 100644 index 0000000..8ec0f92 --- /dev/null +++ b/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientConfig.java @@ -0,0 +1,19 @@ +package com.etl.data.client.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.GsonBuilderUtils; +import org.springframework.stereotype.Component; + +/** + * 数据接入客户端配置 + * @author YunFei.Du + * @date 21:34 2024/5/8 + */ +@ComponentScan +@Import ( value = {DataAccessClientRunner.class}) +public class DataAccessClientConfig { + public static void main(String[] args) { + System.out.println ("连接池 编码" ); + } +} diff --git a/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientRunner.java b/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientRunner.java new file mode 100644 index 0000000..d8b5288 --- /dev/null +++ b/etl-modules/etl-data-source/etl-data-source-client/src/main/java/com/etl/data/client/config/DataAccessClientRunner.java @@ -0,0 +1,22 @@ +package com.etl.data.client.config; + +import feign.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; + +/** + * @ClassName DataAccessClientRunner + * @Description 描述 + * @Author YunFei.Du + * @Date 2024/5/8 21:35 + */ +public class DataAccessClientRunner implements ApplicationRunner { + + + + @Override + public void run(ApplicationArguments args) throws Exception { + + } +} diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataAsset.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataAsset.java index 2e62252..02f8945 100644 --- a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataAsset.java +++ b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataAsset.java @@ -33,13 +33,13 @@ public class DataAsset extends BaseEntity { private Long dataSourceId; /** 表名称 */ - private String tableName; + private String name; /** 表备注 */ - private String tableComment; + private String nameAs; /** 数据量 */ - private Integer tableCount; + private Integer dataTotal; /** 资产模型 */ private Integer fields; diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataSource.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataSource.java index 2851dfa..cbe3f51 100644 --- a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataSource.java +++ b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/DataSource.java @@ -25,81 +25,74 @@ import lombok.experimental.SuperBuilder; @TableName("data_source") public class DataSource extends BaseEntity { private static final long serialVersionUID = 1L; - /** - * 数据源id + * 主键 */ @TableId(value = "id", type = IdType.AUTO) + private Long id; - - /** 数据来源名称 */ + /** + * 接入源名称 + */ + private String name; + /** + * 数据来源系统名称 + */ private String systemName; - /** - * 数据源名称 + * 数据接入类型不能为空 */ - private String dataSourceName; - /** 连接驱动名称 */ - private String jdbcDriver; - - + private String type; /** - * 数据库名称 + * 主机地址 */ - private String databaseName; - - /** 模式名称 (postgres)*/ - private String modeName; + private String host; /** - * 数据库连接ip地址 - */ - private String linkAddress; - - /** - * 端口 + * 主机ip端口 */ private String port; - - /** - * 用户名 + * 数据库 + */ + private String databaseName; + /** + * 用户 */ private String username; - /** * 密码 */ private String password; - - - /** 数据连接参数 */ + /** + * 数据连接参数 + */ private String connectionParam; - - /** 初始连接数量 */ - private Integer initNum; - - /** 最大连接数量 */ - private Integer maxNum; - - /** 最大等待时间 */ - private Integer maxWaitTime; - - /** 最大等待次数 */ - private Integer maxWaitSize; - /** - * 数据源类型 + * 初始连接数量 */ - private String type; + private String initNum; + /** + * 最大连接数量 + */ + private String maxNum; + /** + * 最大等待时间 + */ + private String maxWaitTime; + /** + * 最大等待次数 + */ + private String maxWaitSize; + /** - * 连接池数量 + * 连接驱动 */ - @TableField(exist = false) - private Integer count; - - - + private String jdbcDriver; + /** + * 模式名称 + */ + private String modeName; } diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/decoration/DataSourceDecoration.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/decoration/DataSourceDecoration.java new file mode 100644 index 0000000..28dad24 --- /dev/null +++ b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/decoration/DataSourceDecoration.java @@ -0,0 +1,56 @@ +package com.etl.data.domain.decoration; + +import com.etl.data.domain.DataSource; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @ClassName DataSourceDecoration + * @Description 描述 + * @Author YunFei.Du + * @Date 2024/5/9 8:53 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class DataSourceDecoration { + + /** + * id + */ + private Long id; + /** + * 系统名称 + */ + private String systemName; + + /** + * 数据源名称 + */ + private String name; + /** 连接驱动名称 */ + private String jdbcDriver; + + + /** + * 数据库名称 + */ + private String databaseName; + + + private String type; + + + public static DataSourceDecoration dataSourceBuild(DataSource dataSource) { + return DataSourceDecoration.builder () + .id(dataSource.getId ()) + .name(dataSource.getName ()) + .systemName(dataSource.getSystemName ()) + .databaseName(dataSource.getDatabaseName ()) + .type("dataSource") + .build (); + } +} diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/req/DataSourceQueryReq.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/req/DataSourceQueryReq.java index 0a06903..cce7266 100644 --- a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/req/DataSourceQueryReq.java +++ b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/req/DataSourceQueryReq.java @@ -15,14 +15,14 @@ import lombok.experimental.SuperBuilder; @NoArgsConstructor @SuperBuilder public class DataSourceQueryReq { - private Integer pageNum; + private Integer pageNum=1; - private Integer pageSize; + private Integer pageSize=10; /** * 数据源名称 */ - private String dataSourceName; + private String name; /** * 数据来源名称 @@ -34,5 +34,4 @@ public class DataSourceQueryReq { */ private String databaseName; - private String linkAddress; } diff --git a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/resp/DataSourceResp.java b/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/resp/DataSourceResp.java deleted file mode 100644 index a23bc71..0000000 --- a/etl-modules/etl-data-source/etl-data-source-common/src/main/java/com/etl/data/domain/resp/DataSourceResp.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.etl.data.domain.resp; - -import com.etl.common.core.web.domain.BaseEntity; -import com.etl.data.domain.DataSource; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -import java.util.ArrayList; -import java.util.List; - -/** - * 数据源响应 - * @author YunFei.Du - * @date 14:56 2024/5/1 - */ -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -public class DataSourceResp extends BaseEntity { - /** - * 数据源id - */ - private Long id; - - - /** 数据来源名称 */ - private String systemName; - - /** - * 数据源名称 - */ - private String dataSourceName; - /** 连接驱动名称 */ - private String jdbcDriver; - - - /** - * 数据库名称 - */ - private String databaseName; - - /** 模式名称 (postgres)*/ - private String modeName; - /** - * 数据库连接ip地址 - */ - private String linkAddress; - - /** - * 端口 - */ - private String port; - - - /** - * 用户名 - */ - private String username; - - /** - * 密码 - */ - private String password; - - - /** 数据连接参数 */ - private String connectionParam; - - /** 初始连接数量 */ - private Integer initNum; - - /** 最大连接数量 */ - private Integer maxNum; - - /** 最大等待时间 */ - private Integer maxWaitTime; - - /** 最大等待次数 */ - private Integer maxWaitSize; - - /** - * 数据源类型 - */ - private String type; - - /** - * 数据源数量 - */ - private Integer count; - - /** - * 数据源拼接参数 - */ - private List dataSourceSpliceParam; - - /** - * 根据数据源对象 (数据源+参数) 构建数据源响应对象 - * @param dataSource - * @param dataSourceSpliceParams - * @return - */ - public static DataSourceResp builderDataSource(DataSource dataSource, ArrayList< DataSourceSpliceParam > dataSourceSpliceParams) { - return DataSourceResp.builder () - .id(dataSource.getId()) - .systemName(dataSource.getSystemName()) - .dataSourceName(dataSource.getDataSourceName()) - .jdbcDriver(dataSource.getJdbcDriver()) - .databaseName(dataSource.getDatabaseName()) - .linkAddress(dataSource.getLinkAddress()) - .port(dataSource.getPort()) - .username(dataSource.getUsername()) - .password(dataSource.getPassword ()) - .connectionParam(dataSource.getConnectionParam ()) - .initNum(dataSource.getInitNum ()) - .maxNum(dataSource.getMaxNum ()) - .count(dataSource.getCount ()) - .maxWaitTime(dataSource.getMaxWaitTime ()) - .maxWaitSize(dataSource.getMaxWaitSize ()) - .type(dataSource.getType ()) - .modeName(dataSource.getModeName ()) - .dataSourceSpliceParam(dataSourceSpliceParams) - .build (); - } -} diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataAssetController.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataAssetController.java index c563680..d6147be 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataAssetController.java +++ b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataAssetController.java @@ -1,7 +1,10 @@ package com.etl.data.controller; +import com.etl.common.core.domain.Result; import com.etl.data.service.DataAssetService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataSourceController.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataSourceController.java index df63ac5..1240aee 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataSourceController.java +++ b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/controller/DataSourceController.java @@ -3,22 +3,18 @@ package com.etl.data.controller; import com.etl.common.core.domain.Result; import com.etl.common.core.web.controller.BaseController; import com.etl.common.core.web.page.TableDataInfo; -import com.etl.common.security.utils.SecurityUtils; import com.etl.data.domain.DataAsset; import com.etl.data.domain.DataSource; +import com.etl.data.domain.decoration.DataSourceDecoration; import com.etl.data.domain.req.DataSourceQueryReq; -import com.etl.data.domain.resp.DataSourceResp; import com.etl.data.service.DataSourceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.xml.crypto.Data; -import java.sql.SQLException; -import java.util.Date; import java.util.List; /** - * 数据源 + * 数据源 dataAccess * @author YunFei.Du * @date 21:47 2024/4/25 */ @@ -34,24 +30,18 @@ public class DataSourceController extends BaseController { */ @PostMapping("/list") public Result< TableDataInfo > getDataSourceList (@RequestBody DataSourceQueryReq req) { + startPage(); List list = dataSourceService.selectDataSourceList(req); return getDataAsset (list); } @GetMapping("/getList") - public List< DataSource > getList () { - List list = dataSourceService.getList(); + public List< DataSourceDecoration > getList () { + List list = dataSourceService.getList(); return list; } - /** - * - */ - @GetMapping("getDataSourceById") - public Result getDataSourceById(@RequestParam("id") Long id) { - DataSource dataSource = dataSourceService.getById(id); - return Result.success(dataSource); - } + /** * 编辑数据源(添加/修改) @@ -62,7 +52,14 @@ public class DataSourceController extends BaseController { public Result editDataSource(@RequestBody DataSource dataSource){ return dataSourceService.editDataSource(dataSource); } - + /** + * + */ + @GetMapping("getDataSourceById") + public Result getDataSourceById(@RequestParam("id") Long id) { + DataSource dataSource = dataSourceService.getById(id); + return Result.success(dataSource); + } /** * 删除 * @param id diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/DataSourceService.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/DataSourceService.java index 3d260b5..4eebb8e 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/DataSourceService.java +++ b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/DataSourceService.java @@ -3,9 +3,9 @@ package com.etl.data.service; import com.baomidou.mybatisplus.extension.service.IService; import com.etl.common.core.domain.Result; import com.etl.data.domain.DataSource; +import com.etl.data.domain.decoration.DataSourceDecoration; import com.etl.data.domain.req.DataSourceQueryReq; -import com.etl.data.domain.resp.DataSourceResp; -import org.springframework.web.bind.annotation.RequestBody; + import java.sql.Connection; import java.util.List; @@ -17,7 +17,7 @@ import java.util.List; */ public interface DataSourceService extends IService { - List getList(); + List< DataSourceDecoration > getList(); /** * 获取数据源列表 diff --git a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/impl/DataSourceServiceImpl.java b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/impl/DataSourceServiceImpl.java index e2fbffa..6b64d6a 100644 --- a/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/impl/DataSourceServiceImpl.java +++ b/etl-modules/etl-data-source/etl-data-source-server/src/main/java/com/etl/data/service/impl/DataSourceServiceImpl.java @@ -11,21 +11,20 @@ import com.etl.common.system.domain.SysRole; import com.etl.data.domain.*; import com.etl.data.domain.Dictionary; import com.etl.data.domain.custom.Statistics; +import com.etl.data.domain.decoration.DataSourceDecoration; import com.etl.data.domain.req.DataSourceQueryReq; -import com.etl.data.domain.resp.DataSourceResp; -import com.etl.data.domain.resp.DataSourceSpliceParam; import com.etl.data.mapper.DataSourceMapper; import com.etl.data.service.*; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; import java.sql.*; import java.util.*; import java.util.Date; +import java.util.stream.Collectors; /** @@ -52,57 +51,50 @@ public class DataSourceServiceImpl extends ServiceImpl getList() { + public List< DataSourceDecoration > getList() { + List< DataSource > list = this.list ( ); - return list; + + List< DataSourceDecoration > collect = list.stream ( ).map (DataSourceDecoration::dataSourceBuild ).toList ( ); +// list.stream ( ).map ( DataSourceDecoration::dataSourceBuild).collect ( Collectors.toList ( ) ); + + return collect; + } @Override public List< DataSource > selectDataSourceList(DataSourceQueryReq req) { - // 创建查询包装器,用于构建数据库查询条件 - LambdaQueryWrapper< DataSource > queryWrapper = new LambdaQueryWrapper<> ( ); + List< DataSource > dataSources = this.list ( ); - // 根据请求对象中的数据源名称、系统名称和数据库名称添加查询条件 - if (req.getDataSourceName ()!=null && req.getDatabaseName ()!=""){ - queryWrapper.eq ( DataSource::getDataSourceName, req.getDataSourceName () ); - } - if (req.getSystemName ()!=null && req.getSystemName ()!=""){ - queryWrapper.eq ( DataSource::getSystemName, req.getSystemName () ); - } - if (req.getDatabaseName ()!=null && req.getDatabaseName ()!=""){ - queryWrapper.eq ( DataSource::getDataSourceName, req.getDatabaseName () ); - } - List< DataSource > dataSources = this.list ( queryWrapper ); - - List dataSourceList = new ArrayList(); - List roles = SecurityUtils.getLoginUser().getSysUser().getRoles(); - //判断登录人是否为管理员,不是则需要过滤掉未授权的信息 - if (roles.get(0).getRoleId()==1){ - dataSourceList = dataSources; - }else{ - //数据接入过滤完的主键id集合 - ArrayList longs1 = new ArrayList<>(); - //已授权的数据接入id集合 - - List< Long > sourceIds = sourceAccreditService.list ( new LambdaQueryWrapper< SourceAccredit > ( ).eq ( SourceAccredit::getUserId, SecurityUtils.getUserId ( ) ) ).stream ( ).map ( SourceAccredit::getDataSourceId ).filter ( Objects::nonNull ).toList ( ); - - - //已授权数据模型表的主键id集合 - List< Long > assetIds = assetAccreditService.list ( new LambdaQueryWrapper< AssetAccredit > ( ).eq ( AssetAccredit::getUserId, SecurityUtils.getUserId ( ) ) ).stream ( ).map ( AssetAccredit::getDataAssetId ).filter ( Objects::nonNull ).toList ( ); - - //判断已授权数据模型表的主键id集合是否为空 - if (!assetIds.isEmpty()){ - //获取已授权的数据模型表的数据源id集合 - List< Long > longs = dataAssetService.list ( new LambdaQueryWrapper< DataAsset > ( ).eq ( DataAsset::getDataSourceId, assetIds ) ).stream ( ).map ( DataAsset::getDataSourceId ).toList ( ); - - //添加到已授权的数据源id集合中 - longs1.addAll(longs); - } - longs1.addAll(sourceIds); - //从所有的数据源信息集合中过滤掉未授权的数据源信息 - dataSourceList = dataSources.stream().filter(dataSourceInfo -> longs1.contains(dataSourceInfo.getId())).toList(); - } - return dataSourceList; +// List dataSourceList = new ArrayList(); +// List roles = SecurityUtils.getLoginUser().getSysUser().getRoles(); +// //判断登录人是否为管理员,不是则需要过滤掉未授权的信息 +// if (roles.get(0).getRoleId()==1){ +// dataSourceList = dataSources; +// }else{ +// //数据接入过滤完的主键id集合 +// ArrayList longs1 = new ArrayList<>(); +// //已授权的数据接入id集合 +// +// List< Long > sourceIds = sourceAccreditService.list ( new LambdaQueryWrapper< SourceAccredit > ( ).eq ( SourceAccredit::getUserId, SecurityUtils.getUserId ( ) ) ).stream ( ).map ( SourceAccredit::getDataSourceId ).filter ( Objects::nonNull ).toList ( ); +// +// +// //已授权数据模型表的主键id集合 +// List< Long > assetIds = assetAccreditService.list ( new LambdaQueryWrapper< AssetAccredit > ( ).eq ( AssetAccredit::getUserId, SecurityUtils.getUserId ( ) ) ).stream ( ).map ( AssetAccredit::getDataAssetId ).filter ( Objects::nonNull ).toList ( ); +// +// //判断已授权数据模型表的主键id集合是否为空 +// if (!assetIds.isEmpty()){ +// //获取已授权的数据模型表的数据源id集合 +// List< Long > longs = dataAssetService.list ( new LambdaQueryWrapper< DataAsset > ( ).eq ( DataAsset::getDataSourceId, assetIds ) ).stream ( ).map ( DataAsset::getDataSourceId ).toList ( ); +// +// //添加到已授权的数据源id集合中 +// longs1.addAll(longs); +// } +// longs1.addAll(sourceIds); +// //从所有的数据源信息集合中过滤掉未授权的数据源信息 +// dataSourceList = dataSources.stream().filter(dataSourceInfo -> longs1.contains(dataSourceInfo.getId())).toList(); +// } + return dataSources; // 初始化数据源响应列表 // List< DataSourceResp > dataSourceRespArrayList = new ArrayList<> ( ); // @@ -174,13 +166,13 @@ public class DataSourceServiceImpl extends ServiceImpl DataAssetList = dataAssetService.list ( new LambdaQueryWrapper< DataAsset > ( ).eq ( DataAsset::getDataSourceId, dataSource.getId ( ) ) ); -// List< Long > DataAssetIds = DataAssetList.stream ( ).map ( DataAsset::getId ).toList ( ); -//// 如何id存在删除 -// if (DataAssetIds!=null && DataAssetIds.size ()!=0){ -// //获取所有的数据模型记录 -// List< AssetModel > assetModelList = assetModelService.list ( new LambdaQueryWrapper< AssetModel > ( ).in ( AssetModel::getDataAssetId, DataAssetIds ) ); -// List< Long > assetModelIds = assetModelList.stream ( ).map ( AssetModel::getId ).toList ( ); -// //删除所有源表 -// dataAssetService.removeBatchByIds ( DataAssetIds ); -// -// if (assetModelIds!=null &&assetModelIds.size ()!=0){ -// //删除所有模型 -// assetModelService.removeBatchByIds ( assetModelIds ); -// } -// } // 查询结构 if (dataSource.getType ().equals ( "MySql" )){ // 通过数据库名获取表结构(表名,表行,表模型(列)) @@ -234,7 +210,7 @@ public class DataSourceServiceImpl extends ServiceImpl ( ){{ eq(DataAsset::getDataSourceId,dataAsset.getDataSourceId ()); - eq(DataAsset::getTableName,dataAsset.getTableName ()); + eq(DataAsset::getName,dataAsset.getName ()); }} ); } List< DataAsset > dataAssets = dataAssetService.list ( new LambdaQueryWrapper< DataAsset > ( ).eq ( @@ -263,11 +239,11 @@ public class DataSourceServiceImpl extends ServiceImpl Long.valueOf(dataAsset.getFields())).sum(); - sum2 = dataAssetList.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getTableCount())).sum(); + sum2 = dataAssetList.stream().mapToLong(dataAsset -> Long.valueOf(dataAsset.getDataTotal ())).sum(); statistics.setAssetModel(sum1); statistics.setDataModel(sum2); }else{