feat(): 资产结构概述统计数量
parent
e18623432a
commit
d24a344ac4
|
@ -1,5 +1,13 @@
|
|||
package com.etl.data.structure.domain.resp;
|
||||
|
||||
import com.etl.data.structure.domain.AssetStructureTable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产结构对象表返回类
|
||||
*
|
||||
|
@ -7,5 +15,24 @@ package com.etl.data.structure.domain.resp;
|
|||
* @ClassName: AssetStructureTableResp 资产结构对象表返回类
|
||||
* @CreateTime: 2024/4/23 下午9:54
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AssetStructureTableResp {
|
||||
/**
|
||||
* 数据资产
|
||||
*/
|
||||
private List<AssetStructureTable> assetStructureList;
|
||||
|
||||
/**
|
||||
* 数据资产表总数
|
||||
*/
|
||||
private Long tableCount;
|
||||
|
||||
/**
|
||||
* 数据资产表数据总数
|
||||
*/
|
||||
private Long tableDataCount;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.etl.data.structure.controller;
|
|||
|
||||
import com.etl.common.core.domain.Result;
|
||||
import com.etl.common.security.annotation.RequiresPermissions;
|
||||
import com.etl.data.structure.domain.AssetStructureTable;
|
||||
import com.etl.data.structure.domain.resp.AssetStructureTableResp;
|
||||
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据资产表 Controller 层
|
||||
*
|
||||
|
@ -33,7 +31,7 @@ public class AssetStructureTableController {
|
|||
*/
|
||||
@RequiresPermissions("data:structureTable:list")
|
||||
@PostMapping("list/{assetStructureId}")
|
||||
public Result<List<AssetStructureTable>> list(@PathVariable("assetStructureId") Long assetStructureId) {
|
||||
public Result<AssetStructureTableResp> list(@PathVariable("assetStructureId") Long assetStructureId) {
|
||||
return Result.success(assetStructureTableService.selectAssetSouructureTableList(assetStructureId));
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.etl.data.structure.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.etl.data.structure.domain.AssetStructureTable;
|
||||
|
||||
import java.util.List;
|
||||
import com.etl.data.structure.domain.resp.AssetStructureTableResp;
|
||||
|
||||
/**
|
||||
* 资产结构表表Service接口
|
||||
|
@ -18,6 +17,6 @@ public interface IAssetStructureTableService extends IService<AssetStructureTabl
|
|||
* @param assetStructureId 数据资产id
|
||||
* @return
|
||||
*/
|
||||
List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId );
|
||||
AssetStructureTableResp selectAssetSouructureTableList(Long assetStructureId );
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.etl.data.structure.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.etl.data.structure.domain.AssetStructureTable;
|
||||
import com.etl.data.structure.domain.resp.AssetStructureTableResp;
|
||||
import com.etl.data.structure.mapper.AssetStructureTableMapper;
|
||||
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -24,11 +25,19 @@ public class AssetStructureTableServiceImpl extends ServiceImpl<AssetStructureT
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId) {
|
||||
List<AssetStructureTable> list = this.list(
|
||||
public AssetStructureTableResp selectAssetSouructureTableList(Long assetStructureId) {
|
||||
List<AssetStructureTable> assetStructureTableList = this.list(
|
||||
new LambdaQueryWrapper<AssetStructureTable>()
|
||||
.eq(AssetStructureTable::getAssetStructureId, assetStructureId)
|
||||
);
|
||||
return list;
|
||||
// 统计数据表总数
|
||||
long tableCount = assetStructureTableList.size();
|
||||
long tableDataCount = assetStructureTableList.stream().mapToLong(AssetStructureTable::getTableDataCount).sum();
|
||||
|
||||
return new AssetStructureTableResp(){{
|
||||
setAssetStructureList(assetStructureTableList);
|
||||
setTableCount(tableCount);
|
||||
setTableDataCount(tableDataCount);;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue