统计出数据接入的数量,表的数量,字段的数量

master
冷调 2024-08-21 22:25:56 +08:00
parent 53006fd930
commit b2c3c2a063
13 changed files with 322 additions and 7 deletions

View File

@ -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
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-20:34
* @ Version1.0
* @ Description
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName("asset_accredit")
public class AssetAccredit {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
@Excel(name = "主键")
private Long id;
}

View File

@ -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;
}

View File

@ -89,6 +89,6 @@ public class TableData extends BaseEntity {
* ID
*/
@Excel(name = "数据库结构ID")
private Integer childrenId;
private Long childrenId;
}

View File

@ -0,0 +1,32 @@
package com.muyu.source.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-21:50
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StatisticsResp {
/**
*
*/
private Long dataAccessQuantity;
/**
*
*/
private Long assetModelQuantity;
/**
*
*/
private Long numberOfDataModels;
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:05
* @ Version1.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;
}
}

View File

@ -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();
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:51
* @ Version1.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;
}
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:06
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface ChildrenMapper extends BaseMapper<Children> {
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:52
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface TableDataMapper extends BaseMapper<TableData> {
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:07
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface ChildrenService extends IService<Children> {
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:08
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class ChildrenServiceImpl extends ServiceImpl<ChildrenMapper, Children> implements ChildrenService {
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:53
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class TableDataServiceImpl extends ServiceImpl<TableDataMapper, TableData> implements TableDataService {
}

View File

@ -0,0 +1,15 @@
package com.muyu.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.source.domain.TableData;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-21-19:53
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface TableDataService extends IService<TableData> {
}