geopro/src/data/dto/NavDto.hpp

42 lines
1.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <vector>
#include <QJsonArray>
#include <QJsonObject>
#include "repo/RepoTypes.hpp"
namespace geopro::data::dto {
// 工作空间数组joined/list 的 data["value"])→ 模型。isCurTenant==1 → isCurrent。
std::vector<Workspace> parseWorkspaces(const QJsonArray& arr);
// 项目分页queryByUser 的 data 对象 {hasNextPage, projectList})→ 模型。
struct ProjectPage { std::vector<ProjectSummary> projects; bool hasNextPage = false; };
ProjectPage parseProjects(const QJsonObject& data);
// my/profile/queryProject 的 data["value"] 数组 → 模型(与 parseProjects 同字段映射)。
std::vector<ProjectSummary> parseProjectList(const QJsonArray& arr);
// my/profile/project/page 的整个 data 对象 → ProjectListPagerows + total
ProjectListPage parseProjectPage(const QJsonObject& data);
// project/type/list 的 data["value"] 数组 → 项目类型列表。
std::vector<ProjectType> parseProjectTypes(const QJsonArray& arr);
// 结构扁平节点数组queryProjectStruct 的 data["projectStructList"])→ 模型。
std::vector<StructNode> parseStructNodes(const QJsonArray& arr);
// data/page / file/page 的 data["list"] 数组 → DsRow数据行无 file文件行含 file{name,size,url})。
std::vector<DsRow> parseDsRows(const QJsonArray& arr);
// data/page 或 file/page 的整个 data 对象 → DsPagerows + total
DsPage parseDsPage(const QJsonObject& data);
// 扁平 StructNode 按 parentId 建树。叶子(无子节点)=TM。处理项目直挂 TM、孤儿 parentId、空表。
struct StructTreeNode {
StructNode node;
bool isTm = false;
std::vector<StructTreeNode> children;
};
std::vector<StructTreeNode> buildStructTree(const std::vector<StructNode>& flat);
} // namespace geopro::data::dto