修改文件结构

This commit is contained in:
编码猿
2025-09-16 22:46:14 +08:00
parent 715d3ff0bb
commit c3d4b7e1e4
34 changed files with 55 additions and 6 deletions

34
doc/代码存放位置.md Normal file
View File

@@ -0,0 +1,34 @@
### 1. 领域层Domains
- 实体类:`src/domains/product/domain/entities/Product.ts`
- 仓储接口(端口):`src/domains/product/ports/repositories/ProductRepository.ts`
### 2. 基础设施层Infrastructure
- HTTP仓储实现`src/domains/product/infrastructure/api/HttpProductRepository.ts`
- 通用HTTP客户端`src/shared/infra/http/httpClient.ts`
### 3. 应用服务层Application
- 商品应用服务:`src/domains/product/application/services/ProductApplicationService.ts`
### 4. 依赖注入配置
- 商品领域DI配置`src/app/di/productModule.ts`
### 5. 路由配置(交付层)
- 商品路由:`src/app/router/productRoutes.ts`
- 主路由配置:`src/app/router/index.ts`
### 6. 功能实现(交付层)
- 商品列表页面:`src/features/product/views/ProductList.tsx`
- 商品详情页面:`src/features/product/views/ProductDetail.tsx`
- 商品卡片组件:`src/features/product/components/ProductCard.tsx`
### 7. 通用UI组件交付层
- 分页组件:`src/app/components/Pagination.tsx`
- 加载组件:`src/app/components/Loading.tsx`(代码中引用)
- 按钮组件:`src/app/components/Button.tsx`(代码中引用)

View File

@@ -1,18 +1,18 @@
```txt
src/
├── domains/ # 【核心】领域层 - 所有业务领域模块
│ └── order/ # 订单领域模块
│ └── product/ # 订单领域模块
│ ├── domain/ # 领域模型(充血模型)
│ │ ├── entities/ # 实体(如:Order, OrderLineItem
│ │ ├── entities/ # 实体(如:Product, ProductLineItem
│ │ ├── value-objects/ # 值对象Money, Address
│ │ ├── enums/ # 领域枚举
│ │ └── events/ # 领域事件(如果需要)
│ ├── application/ # 应用服务层 - 协调领域对象完成用例
│ │ └── services/ # 应用服务(如:OrderApplicationService
│ │ └── services/ # 应用服务(如:ProductApplicationService
│ ├── infrastructure/ # 基础设施层 - 领域层的具体实现
│ │ └── api/ # 数据获取实现HttpOrderRepository
│ │ └── api/ # 数据获取实现HttpProductRepository
│ ├── ports/ # 端口(接口/抽象类)- 定义契约
│ │ └── repositories/ # 仓储接口(如:OrderRepository
│ │ └── repositories/ # 仓储接口(如:ProductRepository
│ └── use-cases/ # (可选)或将用例放在这里
├── app/ # 【交付层】应用组装和配置路由、状态管理、主布局、UI库设置、错误处理、依赖注入容器
│ ├── components/ # 通用UI组件与业务无关如ButtonModal
@@ -22,7 +22,7 @@ src/
│ └── main.ts # 应用入口,依赖注入的组装之地
│ └── App.vue # 根组件
├── features/ # 【交付层】基于领域的功能模块:关注具体的业务功能实现,它是舞台上的“演员”和“节目”。
│ └── order/ # 订单功能模块
│ └── product/ # 订单功能模块
│ ├── components/ # 订单领域专用的UI组件
│ ├── views/ # 订单相关的页面级Vue组件
│ ├── composables/ # 订单相关的Vue组合式函数