feat:数据统计组件
parent
ed38fe8109
commit
606a05d68e
|
@ -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<Structure> structureList;
|
||||||
|
|
||||||
|
}
|
|
@ -35,5 +35,5 @@ public class TableTreeResp {
|
||||||
/**
|
/**
|
||||||
* 子级信息
|
* 子级信息
|
||||||
*/
|
*/
|
||||||
private List<TableInfo> Children;
|
private List<TableInfoStructureResp> Children;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.muyu.etl.service.impl;
|
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.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.etl.domain.BasicConfigInfo;
|
import com.muyu.etl.domain.BasicConfigInfo;
|
||||||
import com.muyu.etl.domain.Structure;
|
import com.muyu.etl.domain.Structure;
|
||||||
import com.muyu.etl.domain.TableInfo;
|
import com.muyu.etl.domain.TableInfo;
|
||||||
|
import com.muyu.etl.domain.resp.TableInfoStructureResp;
|
||||||
import com.muyu.etl.domain.resp.TableTreeResp;
|
import com.muyu.etl.domain.resp.TableTreeResp;
|
||||||
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
import com.muyu.etl.mapper.BasicConfigInfoMapper;
|
||||||
import com.muyu.etl.service.BasicConfigInfoService;
|
import com.muyu.etl.service.BasicConfigInfoService;
|
||||||
|
@ -229,7 +231,6 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
String NumericScale = String.valueOf(resultSet.getInt(8));
|
String NumericScale = String.valueOf(resultSet.getInt(8));
|
||||||
String isNullable = String.valueOf( resultSet.getObject(9));
|
String isNullable = String.valueOf( resultSet.getObject(9));
|
||||||
String columnDefault = String.valueOf( resultSet.getObject(10));
|
String columnDefault = String.valueOf( resultSet.getObject(10));
|
||||||
|
|
||||||
Structure build = Structure.builder()
|
Structure build = Structure.builder()
|
||||||
.tableId(table.getId())
|
.tableId(table.getId())
|
||||||
.columnName(String.valueOf(columnName))
|
.columnName(String.valueOf(columnName))
|
||||||
|
@ -243,11 +244,10 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
||||||
.defaultValue( columnDefault)
|
.defaultValue( columnDefault)
|
||||||
.build();
|
.build();
|
||||||
log.info(build);
|
|
||||||
structureService.saveOrUpdate(build,new LambdaUpdateWrapper<Structure>(){{
|
structureService.saveOrUpdate(build,new LambdaUpdateWrapper<Structure>(){{
|
||||||
eq(Structure::getTableId,build.getTableId());
|
eq(Structure::getTableId,build.getTableId());
|
||||||
eq(Structure::getColumnName,build.getColumnName());
|
eq(Structure::getColumnName,build.getColumnName());
|
||||||
eq(Structure::getRemark,build.getRemark());
|
eq(Structure::getColumnRemark,build.getColumnRemark());
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,22 +308,28 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
public List<TableTreeResp> getTableTree() {
|
public List<TableTreeResp> getTableTree() {
|
||||||
List<TableTreeResp> tableTreeRespList = tableInfoService.selectTableInfoList(new TableInfo(){{setParentId(0L);}}).stream().map(tableInfo ->{
|
List<TableTreeResp> tableTreeRespList = tableInfoService.selectTableInfoList(new TableInfo(){{setParentId(0L);}}).stream().map(tableInfo ->{
|
||||||
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
|
BasicConfigInfo basicConfigInfo = this.selectBasicConfigInfoById(tableInfo.getBasicId());
|
||||||
List<TableInfo> tableInfoList = tableInfoService.selectTableInfoList(new TableInfo() {{
|
List<TableInfoStructureResp> tableInfoStructureRespList = tableInfoService.selectTableInfoList(new TableInfo() {{
|
||||||
setParentId(tableInfo.getId());
|
setParentId(tableInfo.getId());
|
||||||
}});
|
}}).stream().map(info -> {
|
||||||
|
List<Structure> structureList = structureService.list(new LambdaQueryWrapper<Structure>().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()
|
return TableTreeResp.builder()
|
||||||
.tableInfo(tableInfo)
|
.tableInfo(tableInfo)
|
||||||
.basicConfigInfo(basicConfigInfo)
|
.basicConfigInfo(basicConfigInfo)
|
||||||
.Children(tableInfoList)
|
.Children(tableInfoStructureRespList)
|
||||||
.build();
|
.build();
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return tableTreeRespList;
|
return tableTreeRespList;
|
||||||
}
|
}
|
||||||
//{
|
|
||||||
// label: '一级 1',
|
|
||||||
// children: [{
|
|
||||||
// label: '二级 1-1',
|
|
||||||
// data
|
|
||||||
// }]
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue