diff --git a/README.md b/README.md index 6b4f074..acb9cc7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,83 @@ -# pda_template +### pda_template +#### 项目结构 + +```text +├─app # 主应用模块 +│ ├─config # 应用配置文件 +│ ├─enum # 枚举类 +│ ├─routing # 路由配置 +│ └─theme # 主题样式 +├─core # 核心基础模块 +│ ├─api # API 通信相关 +│ │ ├─clients # API 客户端(网络请求封装) +│ │ │ └─impl # 具体实现类 +│ │ ├─config # Yaml配置文件解析类 +│ │ └─models # 数据模型(请求/响应体) +│ │ ├─entries # 实体类定义 +│ │ ├─requests # 请求体 +│ │ └─responses # 响应体 +│ ├─di # 依赖注入配置 +│ └─utils # 工具类 +│ └─extensions # 扩展函数/方法 +├─features # 功能模块(按业务拆分) +│ ├─order # 订单功能模块 +│ │ ├─business_logic # 业务逻辑(用例、通知等) +│ │ │ ├─notifiers # 状态通知类 +│ │ │ └─repositories # 数据仓库接口 +│ │ └─presentation # 界面层(屏幕/组件) +│ │ ├─screens # 页面级组件 +│ │ └─widgets # 可复用小组件 +│ ├─page # 基础页面(home, login) +│ │ ├─business_logic # 业务逻辑 +│ │ │ └─notifiers # 状态通知类 +│ │ ├─data # 数据层(本地/远程) +│ │ │ └─repositories # 数据仓库实现 +│ │ ├─domain # 领域模型 +│ │ │ ├─models # 领域实体 +│ │ │ └─repositories # 领域仓库接口 +│ │ └─presentation # 页面展示组件 +│ └─stock # 库存管理模块 +│ ├─business_logic # 库存业务逻辑 +│ │ ├─notifiers # 库存状态监听 +│ │ └─repositories# 库存仓库接口 +│ ├─data # 数据层 +│ │ ├─datasources # 数据源(本地/远程) +│ │ └─repositories# 库存仓库实现 +│ ├─domain # 库存领域模型 +│ │ ├─models # 库存实体 +│ │ └─repositories# 领域仓库接口 +│ └─presentation # 库存界面层 +│ ├─screens # 库存页面 +│ └─widgets # 库存组件 +└─images # 静态资源 + └─ico # 弹窗图标文件 +``` + +#### 二次开发指南 + +##### app模块 + +* `lib/app/config/endpoints.yaml:` 添加`Http`接口路径 + +* `lib/app/enum:` 有需要则添加枚举 + +##### core模块 + +* `lib/core/api/clients/wms_api_client.dart:` `API`客户端抽象类添加接口 +* `lib/core/api/clients/impl/wms_v1_api_client.dart:` 实现`API`客户端抽象类, 有需要则创建`wms_v2_api_client.dart` + +* `lib/core/api/models/entries:` 按需添加`DTO`实体类, 供请求体和响应体引用 +* `lib/core/api/models/requests:` 定义请求体 +* `lib/core/api/models/responses:` 定义响应体 +* `lib/core/di/providers.dart:` 依赖注入类, **添加生产者(每个页面一个生产者)** + +##### feature模块 + +* `lib/features/page/presentation/home.dart:` 添加新页面的路由 +* `lib/features/stock/business_logic/notifiers:` **定义状态通知类(每个页面对应一个通知类)** +* `lib/features/stock/data/repositories/stock_repository_impl.dart` 库存业务仓库实现, 定义`API`接口的调用方式, 并进行领域实体模型的转换并将`API`接口返回值由`DTO`转换为领域实体模型 +* `lib/features/stock/domain/models:` 定义领域模型 +* `lib/features/stock/domain/repositories/stock_repository.dart:` 添加库存业务仓库抽象类接口 + +* `lib/features/stock/presentation/screens:` 应用页面, **添加消费者(每个页面一个消费者)** \ No newline at end of file