09061451:对数据库结构的数据量做一个实时

master
冷调 2024-09-06 14:51:41 +08:00
parent b911e8edeb
commit efc218a71a
3 changed files with 18 additions and 2 deletions

View File

@ -66,7 +66,6 @@ public class DataValueController {
Integer i = dataValueService.addTableValue(dataValueModel);
return Result.success(i);
}
/**
* ID
*
@ -76,7 +75,7 @@ public class DataValueController {
*/
@PostMapping("/findTableValueByTableName")
@Operation(summary = "根据基础表ID和SQL语句查询数据", description = "根据基础表ID和SQL语句查询数据")
public Result findTableValueByTableName(@RequestParam("basicId") Long basicId, @RequestParam("tableName") String tableName) throws SQLException {
public Result findTableValueByTableName(@RequestParam("basicId") Long basicId, @RequestParam("tableName") String tableName) {
List<DataValue> dataValueList = dataValueService.findTableValueByTableName(basicId, tableName);
return Result.success(dataValueList);
}

View File

@ -1,6 +1,8 @@
package com.muyu.source.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
@ -10,6 +12,8 @@ import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.source.domain.Structure;
import com.muyu.source.domain.TableData;
import com.muyu.source.domain.TableInfo;
import com.muyu.source.service.StructureService;
import com.muyu.source.service.TableDataService;
import com.muyu.source.service.TableInfoService;
import io.swagger.v3.oas.annotations.Operation;
@ -44,6 +48,8 @@ public class TableDataController extends BaseController {
private TableDataService tableDataService;
@Autowired
private TableInfoService tableInfoService;
@Autowired
private StructureService structureService;
/**
* childrenId
*
@ -63,6 +69,16 @@ public class TableDataController extends BaseController {
*/
@GetMapping("/selectStructureById/{id}")
public Result<List<Structure>> selectStructureById(@PathVariable("id") Integer id) {
//根据id查询表结构中的数据量
long count = structureService.count(new LambdaQueryWrapper<>() {{
eq(Structure::getTableId, id);
}});
if (count!=0L) {
boolean update = tableInfoService.update(new LambdaUpdateWrapper<>() {{
eq(TableInfo::getId, id)
.set(TableInfo::getDataNum, count);
}});
}
List<Structure> structureList =tableInfoService.selectTableInfoById(id);
return success(structureList);
}

View File

@ -45,6 +45,7 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
List<Structure> structureList = structureMapper.selectList(new LambdaQueryWrapper<>(Structure.class) {{
eq(Structure::getTableId, id);
}});
return structureList;
}