feat:(资产也够已完善) 后端
parent
8f078e2081
commit
b6b2624e1c
|
@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
public class MuYuKVTApplication {
|
public class MuYuKVTApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MuYuKVTApplication.class);
|
SpringApplication.run(MuYuKVTApplication.class);
|
||||||
|
|
||||||
System.out.println(" " +
|
System.out.println(" " +
|
||||||
" _ooOoo_\n" +
|
" _ooOoo_\n" +
|
||||||
" o8888888o\n" +
|
" o8888888o\n" +
|
||||||
|
|
|
@ -37,7 +37,6 @@ public class DictionaryDataController extends BaseController {
|
||||||
List<DictionaryData> list = dictionaryDataService.selectDictionaryDataList(dictionaryData);
|
List<DictionaryData> list = dictionaryDataService.selectDictionaryDataList(dictionaryData);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出【请填写功能名称】列表
|
* 导出【请填写功能名称】列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,6 +7,8 @@ import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassDescription:
|
* @ClassDescription:
|
||||||
* @JdkVersion: 17
|
* @JdkVersion: 17
|
||||||
|
@ -82,6 +84,16 @@ public class AssetModel extends BaseEntity {
|
||||||
*
|
*
|
||||||
* **/
|
* **/
|
||||||
private String dictKey;
|
private String dictKey;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 字典key
|
||||||
|
* */
|
||||||
|
private Long dictionaryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典信息
|
||||||
|
* */
|
||||||
|
private List<DictionaryData> dictionaryDataList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
/** 字典
|
/** 字典表名
|
||||||
* @ClassDescription:
|
* @ClassDescription:
|
||||||
* @JdkVersion: 17
|
* @JdkVersion: 17
|
||||||
* @Author: zhangxu
|
* @Author: zhangxu
|
||||||
|
@ -30,7 +30,7 @@ public class DictionaryData extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 字典标签
|
* 字典标签
|
||||||
* */
|
* */
|
||||||
private String lable;
|
private String label;
|
||||||
/**
|
/**
|
||||||
* 字典值
|
* 字典值
|
||||||
* */
|
* */
|
||||||
|
@ -46,7 +46,7 @@ public class DictionaryData extends BaseEntity {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", getId())
|
.append("id", getId())
|
||||||
.append("dictionaryId", getDictionaryId())
|
.append("dictionaryId", getDictionaryId())
|
||||||
.append("lable", getLable())
|
.append("label", getLabel())
|
||||||
.append("val", getVal())
|
.append("val", getVal())
|
||||||
.append("isEdit", getIsEdit())
|
.append("isEdit", getIsEdit())
|
||||||
.toString();
|
.toString();
|
||||||
|
|
|
@ -65,7 +65,8 @@ public interface DictionaryDataMapper {
|
||||||
|
|
||||||
List<DictionaryData> getDictionaryDataList(@Param("dictionaryIds") List<Long> dictionaryIds);
|
List<DictionaryData> getDictionaryDataList(@Param("dictionaryIds") List<Long> dictionaryIds);
|
||||||
|
|
||||||
void deleteDictionaryData(@Param("dictionaryIds") List<Long> dictionaryIds);
|
|
||||||
|
void deleteDictionaryData(@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,8 @@ import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.zx.domain.AssetsData;
|
import com.zx.domain.AssetsData;
|
||||||
import com.zx.domain.DataKvt;
|
import com.zx.domain.DataKvt;
|
||||||
import com.zx.domain.req.AssetModel;
|
import com.zx.domain.req.*;
|
||||||
import com.zx.domain.req.DataAsset;
|
|
||||||
import com.zx.domain.req.JdbcClass;
|
|
||||||
|
|
||||||
import com.zx.domain.req.Statistics;
|
|
||||||
import com.zx.mapper.AssetModelMapper;
|
import com.zx.mapper.AssetModelMapper;
|
||||||
import com.zx.mapper.DataAssetMapper;
|
import com.zx.mapper.DataAssetMapper;
|
||||||
import com.zx.mapper.KvtMapper;
|
import com.zx.mapper.KvtMapper;
|
||||||
|
@ -42,6 +39,11 @@ public class KvtServiceImpl implements KvtService{
|
||||||
private AssetModelMapper assetModelMapper;
|
private AssetModelMapper assetModelMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictionaryServiceImpl dictionaryService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JdbcClass selectJdbcById(Long id) {
|
public JdbcClass selectJdbcById(Long id) {
|
||||||
|
|
||||||
|
@ -620,21 +622,39 @@ public class KvtServiceImpl implements KvtService{
|
||||||
return Result.success(dataAssets);
|
return Result.success(dataAssets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计数据资产的相关信息。
|
||||||
|
* 该方法不接受任何参数,返回数据资产的统计结果,包括数据资产的数量、数据模型总数和数据表总数。
|
||||||
|
*
|
||||||
|
* @return Result<Statistics> 包含统计数据的Result对象,其中Statistics包含数据资产数量、数据模型总数和数据表总数。
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result statistics() {
|
public Result statistics() {
|
||||||
//查询所有书库源
|
// 从kvtMapper中查询所有数据资产,并将其ID提取为列表
|
||||||
List<JdbcClass> dataAssets = kvtMapper.selectList(new JdbcClass());
|
List<JdbcClass> dataAssets = kvtMapper.selectList(new JdbcClass());
|
||||||
//获取所有的数据主键
|
|
||||||
List<Long> list = dataAssets.stream().map(JdbcClass::getId).toList();
|
List<Long> list = dataAssets.stream().map(JdbcClass::getId).toList();
|
||||||
|
|
||||||
|
// 根据数据资产的ID列表,查询每个数据资产的数据模型和数据表数量
|
||||||
List<DataAsset> dataAssets1 = dataAssetMapper.selectDataAssetBatchId(list);
|
List<DataAsset> dataAssets1 = dataAssetMapper.selectDataAssetBatchId(list);
|
||||||
|
|
||||||
|
// 初始化统计信息
|
||||||
Statistics statistics = new Statistics();
|
Statistics statistics = new Statistics();
|
||||||
|
// 设置数据资产的数量
|
||||||
statistics.setDataAsset(Long.valueOf(dataAssets.size()));
|
statistics.setDataAsset(Long.valueOf(dataAssets.size()));
|
||||||
|
|
||||||
|
// 计算所有数据资产的数据模型总数和数据表总数
|
||||||
long sum1;
|
long sum1;
|
||||||
long sum2=0;
|
long sum2=0;
|
||||||
sum1=dataAssets1.stream().mapToLong(value -> Long.valueOf(value.getFields())).sum();
|
sum1=dataAssets1.stream().mapToLong(value -> Long.valueOf(value.getFields())).sum();
|
||||||
sum2=dataAssets1.stream().mapToLong(value -> Long.valueOf(value.getTableCount())).sum();
|
sum2=dataAssets1.stream().mapToLong(value -> Long.valueOf(value.getTableCount())).sum();
|
||||||
|
|
||||||
|
// 设置数据模型总数和数据表总数
|
||||||
statistics.setAssetModel(sum1);
|
statistics.setAssetModel(sum1);
|
||||||
statistics.setDataModel(sum2);
|
statistics.setDataModel(sum2);
|
||||||
|
|
||||||
|
// 返回统计结果
|
||||||
return Result.success(statistics);
|
return Result.success(statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,6 +663,21 @@ public class KvtServiceImpl implements KvtService{
|
||||||
AssetModel assetModel = new AssetModel();
|
AssetModel assetModel = new AssetModel();
|
||||||
assetModel.setDataAssetId(jdbcClass.getId());
|
assetModel.setDataAssetId(jdbcClass.getId());
|
||||||
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
||||||
|
List<String> list = assetModels.stream().map(AssetModel::getDictKey).toList();
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
Result<List<Dictionary>> dictionaryDataList = dictionaryService.getDictionaryDataList(list);
|
||||||
|
List<Dictionary> data = dictionaryDataList.getData();
|
||||||
|
assetModels.stream().
|
||||||
|
forEach(assetModel1 ->{
|
||||||
|
data.stream().forEach(dictionary -> {
|
||||||
|
if (assetModel1.getDictKey().equals(assetModel1.getDictKey())){
|
||||||
|
assetModel1.setDictionaryDataList(dictionary.getDictionaryDataList());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
return Result.success(assetModels);
|
return Result.success(assetModels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue