From fc458ec702005b0899a5faa14d1bad3fc27435a9 Mon Sep 17 00:00:00 2001 From: gaozheng Date: Tue, 9 Jun 2026 10:56:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(data):=20=E5=AF=BC=E8=88=AA=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B(Workspace/ProjectSummary/StructNode)=20+=20IProjectRe?= =?UTF-8?q?pository=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/repo/IProjectRepository.hpp | 27 +++++++++++++++++++++++++++ src/data/repo/RepoTypes.hpp | 9 +++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/data/repo/IProjectRepository.hpp diff --git a/src/data/repo/IProjectRepository.hpp b/src/data/repo/IProjectRepository.hpp new file mode 100644 index 0000000..e064370 --- /dev/null +++ b/src/data/repo/IProjectRepository.hpp @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include "repo/RepoTypes.hpp" + +namespace geopro::data { + +// 仓储结果信封:网络可失败,故用显式 Result 而非抛异常,便于 UI 出错误/空状态。 +template +struct RepoResult { + bool ok = false; + T value{}; + std::string error; +}; + +// 导航仓储抽象(同步;呼应既有 IDatasetRepository 风格)。 +class IProjectRepository { +public: + virtual ~IProjectRepository() = default; + virtual RepoResult> listWorkspaces() = 0; + virtual RepoResult switchWorkspace(const std::string& tenantId) = 0; + virtual RepoResult> listProjects(const std::string& lastProjectId) = 0; + virtual RepoResult> loadStructure(const std::string& projectId) = 0; + virtual RepoResult> loadDatasetsOfTm(const std::string& tmObjectId) = 0; +}; + +} // namespace geopro::data diff --git a/src/data/repo/RepoTypes.hpp b/src/data/repo/RepoTypes.hpp index b671c54..f78aeff 100644 --- a/src/data/repo/RepoTypes.hpp +++ b/src/data/repo/RepoTypes.hpp @@ -6,4 +6,13 @@ struct DsNode { std::string id, name, ddType; }; struct TmNode { std::string id, name, confCode; std::vector dss; }; struct GsNode { std::string id, name; std::vector tms; }; struct Project { std::string id, name; std::vector gss; }; + +// 工作空间(=企业租户/空间)。ownerType: 1 个人空间 2 企业空间。 +struct Workspace { std::string id, name; int ownerType = 0; bool isCurrent = false; }; + +// 项目摘要(列表用)。crsCode/crsName 为项目参考坐标系,下一轮替换硬编码 EPSG:4547。 +struct ProjectSummary { std::string id, name, typeName, crsCode, crsName; int status = 0; }; + +// 项目结构扁平节点(仅 GS / TM)。客户端按 parentId 建树,叶子=TM。 +struct StructNode { std::string id, name, parentId, typeName, confCode; int type = 0; }; } // namespace geopro::data