feat(): 资产结构概述统计数量

dev
chao 2024-04-24 15:12:04 +08:00
parent e18623432a
commit d24a344ac4
4 changed files with 43 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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