refactor: 重构产品相关Mapper

- 空值处理与类型控制:为相关关系型字段的数据处理添加空值处理与类型控制
- 调整目录结构:将文件目录按照实际查询划分为Product和ProductList两个文件
This commit is contained in:
2025-12-04 17:38:43 +08:00
parent f081a3b33a
commit 1245df497b
14 changed files with 801 additions and 414 deletions

View File

@ -2,9 +2,6 @@ export * from './solution-view';
export * from './solution-list-view';
export * from './product-view';
export * from './product-list-view';
export * from './product-spec-group-view';
export * from './product-document-view';
export * from './product-question-view';
export * from './document-list-view';
export * from './question-list-view';
export * from './company-profile-view';

View File

@ -1,23 +0,0 @@
/**
* 文档视图模型
* 用于文档列表渲染的数据结构
*/
export interface ProductDocumentView {
/** 唯一标识符 **/
id: string;
/** 文件UUID **/
fileId: string;
/** 文件名 **/
filename: string;
/** 文档标题 **/
title: string;
/** 文档大小 **/
size: number;
/** 文档链接 **/
url: string;
}

View File

@ -1,14 +0,0 @@
/**
* 常见问题视图模型
* 用于产品页常见问题渲染的数据结构
*/
export interface ProductQuestionView {
/** 唯一标识符 **/
id: string;
/** 问题标题 **/
title: string;
/** 问题内容 **/
content: string;
}

View File

@ -1,29 +0,0 @@
/**
* 产品规格模型
* 用于产品规格渲染的数据结构
*/
export interface ProductSpecView {
/** 唯一标识符 **/
id: string;
/** 规格名称 **/
key: string;
/** 规格值 **/
value: string;
}
/**
* 产品规格表模型
* 用于产品规格表渲染的数据结构
*/
export interface ProductSpecGroupView {
/** 唯一标识符 **/
id: string;
/** 规格组名称 **/
name: string;
/** 规格组 **/
specs: ProductSpecView[];
}

View File

@ -1,13 +1,82 @@
import type { ProductSpecGroupView } from './product-spec-group-view';
import type { ProductQuestionView } from './product-question-view';
import type { ProductDocumentView } from './product-document-view';
interface ImageView {
/**
* 产品图片视图模型
* 用于产品详情页(/products/[slug])中的产品图片数据结构
*/
export interface ProductImageView {
id: string;
image: string;
caption: string;
}
/**
* 产品规格模型
* 用于产品规格渲染的数据结构
*/
export interface ProductSpecView {
/** 唯一标识符 **/
id: string;
/** 规格名称 **/
key: string;
/** 规格值 **/
value: string;
}
/**
* 产品规格表模型
* 用于产品规格表渲染的数据结构
*/
export interface ProductSpecGroupView {
/** 唯一标识符 **/
id: string;
/** 规格组名称 **/
name: string;
/** 规格组 **/
specs: ProductSpecView[];
}
/**
* 常见问题视图模型
* 用于产品页常见问题渲染的数据结构
*/
export interface ProductQuestionView {
/** 唯一标识符 **/
id: string;
/** 问题标题 **/
title: string;
/** 问题内容 **/
content: string;
}
/**
* 文档视图模型
* 用于文档列表渲染的数据结构
*/
export interface ProductDocumentView {
/** 唯一标识符 **/
id: string;
/** 文件UUID **/
fileId: string;
/** 文件名 **/
filename: string;
/** 文档标题 **/
title: string;
/** 文档大小 **/
size: number;
/** 文档链接 **/
url: string;
}
/**
* 产品视图模型
* 用于产品详情页(/products/[slug])渲染的数据结构
@ -22,11 +91,8 @@ export interface ProductView {
/** 产品简介 **/
summary: string;
/** 产品类型 **/
product_type: string;
/** 产品图片 **/
images: ImageView[];
images: ProductImageView[];
/** 产品详情 **/
description: string;