统计出数据接入的数量,表的数量,字段的数量
parent
53006fd930
commit
b2c3c2a063
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.source.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-20:34
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("asset_accredit")
|
||||
public class AssetAccredit {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Excel(name = "主键")
|
||||
private Long id;
|
||||
|
||||
}
|
|
@ -45,11 +45,11 @@ public class Children extends BaseEntity {
|
|||
* 数据条数
|
||||
*/
|
||||
@Excel(name = "数据条数")
|
||||
private Integer dataTotal;
|
||||
private Long dataTotal;
|
||||
/**
|
||||
* 数据源
|
||||
*/
|
||||
@Excel(name = "数据源id")
|
||||
private Integer assetId;
|
||||
private Long assetId;
|
||||
|
||||
}
|
||||
|
|
|
@ -89,6 +89,6 @@ public class TableData extends BaseEntity {
|
|||
* 数据库结构ID
|
||||
*/
|
||||
@Excel(name = "数据库结构ID")
|
||||
private Integer childrenId;
|
||||
private Long childrenId;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.source.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-21:50
|
||||
* @ Version:1.0
|
||||
* @ Description:统计
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StatisticsResp {
|
||||
|
||||
/**
|
||||
* 数据接入统计数量
|
||||
*/
|
||||
private Long dataAccessQuantity;
|
||||
/**
|
||||
* 资产模型统计数量
|
||||
*/
|
||||
private Long assetModelQuantity;
|
||||
/**
|
||||
* 数据源统计数量
|
||||
*/
|
||||
private Long numberOfDataModels;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.Children;
|
||||
import com.muyu.source.service.ChildrenService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:05
|
||||
* @ Version:1.0
|
||||
* @ Description:数据库结构控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/children")
|
||||
@Tag(name = "数据库结构控制层",description = "进行数据库结构管理,查看等相关操作")
|
||||
public class ChildrenController {
|
||||
|
||||
@Autowired
|
||||
private ChildrenService childrenService;
|
||||
/**
|
||||
* 查询数据库结构
|
||||
* @param id 数据库id
|
||||
* @return 数据库结构
|
||||
*/
|
||||
@GetMapping("/selectChildren/{id}")
|
||||
public Result<Children> selectChildren(@PathVariable("id") Integer id){
|
||||
Children children = childrenService.getById(id);
|
||||
return Result.success(children);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单个数据库中表的数量
|
||||
* @param id 数据库结构ID
|
||||
* @return 资产数据模型数量
|
||||
*/
|
||||
@GetMapping("/getTableDataCount/{id}")
|
||||
public Result getTableDataCount(@PathVariable("id") Integer id){
|
||||
//TODO 统计资产模型的总数量
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.source.domain.DataSource;
|
||||
import com.muyu.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.source.service.DataSourceService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.HttpRequestHandler;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -64,6 +67,39 @@ public class DataSourceController extends BaseController {
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据源
|
||||
* @param dataSource 数据源
|
||||
* @param response response
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public void derive(DataSource dataSource,HttpServletResponse response){
|
||||
List<DataSource> list = dataSourceService.list(dataSource);
|
||||
ExcelUtil<DataSource> excelUtil = new ExcelUtil<>(DataSource.class);
|
||||
excelUtil.exportExcel(response, list, "数据源数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据源详细信息
|
||||
* @param id 数据源ID
|
||||
* @return 数据源详细信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result<DataSource> getById(@PathVariable("id") Long id){
|
||||
return Result.success(dataSourceService.getById(id));
|
||||
}
|
||||
/**
|
||||
* 查询表数据总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectTableDataCount")
|
||||
public Result selectTableDataCount() {
|
||||
//TODO 统计出数据接入的数量
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加数据源
|
||||
* @param dataSource 数据源
|
||||
|
@ -88,12 +124,12 @@ public class DataSourceController extends BaseController {
|
|||
|
||||
/**
|
||||
* 删除数据源
|
||||
* @param dataSource 数据源
|
||||
* @param id 数据源
|
||||
* @return 数据源
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public Result delete(@RequestBody DataSource dataSource){
|
||||
dataSourceService.removeById(dataSource);
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public Result delete(@PathVariable("id") List<Long> id){
|
||||
dataSourceService.removeBatchByIds(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.domain.TableData;
|
||||
import com.muyu.source.service.TableDataService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:51
|
||||
* @ Version:1.0
|
||||
* @ Description:表结构控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tableData")
|
||||
@Tag(name = "表结构控制层",description = "进行表结构管理,查看等相关操作")
|
||||
public class TableDataController {
|
||||
@Autowired
|
||||
private TableDataService tableDataService;
|
||||
|
||||
/**
|
||||
* 根据id查询表结构
|
||||
* @param id id
|
||||
* @return 表结构
|
||||
*/
|
||||
@GetMapping("/selectTableData/{id}")
|
||||
public Result<TableData> selectTableData(@PathVariable("id") Integer id){
|
||||
return Result.success(tableDataService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计出一个表中字段的数量
|
||||
* @param id 表ID
|
||||
* @return 数量
|
||||
*/
|
||||
@GetMapping("/selectTableDataCount/{id}")
|
||||
public Result selectTableDataCount(@PathVariable("id") Integer id){
|
||||
//TODO 统计出数据模型的数量
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.source.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.source.domain.Children;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:06
|
||||
* @ Version:1.0
|
||||
* @ Description:数据库结构持久层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChildrenMapper extends BaseMapper<Children> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.source.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.source.domain.TableData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:52
|
||||
* @ Version:1.0
|
||||
* @ Description:表结构持久层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Mapper
|
||||
public interface TableDataMapper extends BaseMapper<TableData> {
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.source.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.domain.Children;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:07
|
||||
* @ Version:1.0
|
||||
* @ Description:数据库结构业务层
|
||||
* @author Lenovo
|
||||
*/
|
||||
public interface ChildrenService extends IService<Children> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.source.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.source.domain.Children;
|
||||
import com.muyu.source.mapper.ChildrenMapper;
|
||||
import com.muyu.source.service.ChildrenService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:08
|
||||
* @ Version:1.0
|
||||
* @ Description:数据库结构业务实现层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Service
|
||||
public class ChildrenServiceImpl extends ServiceImpl<ChildrenMapper, Children> implements ChildrenService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.source.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.source.domain.TableData;
|
||||
import com.muyu.source.mapper.TableDataMapper;
|
||||
import com.muyu.source.service.TableDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:53
|
||||
* @ Version:1.0
|
||||
* @ Description:表结构业务实现层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Service
|
||||
public class TableDataServiceImpl extends ServiceImpl<TableDataMapper, TableData> implements TableDataService {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.source.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.domain.TableData;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-19:53
|
||||
* @ Version:1.0
|
||||
* @ Description:表结构业务层
|
||||
* @author Lenovo
|
||||
*/
|
||||
public interface TableDataService extends IService<TableData> {
|
||||
}
|
Loading…
Reference in New Issue