diff --git a/furniture-3d-system/prisma/migrations/20260413103000_make_substrate_system_name_optional/migration.sql b/furniture-3d-system/prisma/migrations/20260413103000_make_substrate_system_name_optional/migration.sql new file mode 100644 index 00000000..371075d7 --- /dev/null +++ b/furniture-3d-system/prisma/migrations/20260413103000_make_substrate_system_name_optional/migration.sql @@ -0,0 +1,4 @@ +ALTER TABLE "Substrate" +ALTER COLUMN "systemNameOptionId" DROP NOT NULL; + +DROP INDEX IF EXISTS "Substrate_categoryId_environmentGradeId_thicknessSpecId_sur_key"; diff --git a/furniture-3d-system/src/app/asset-center/material-library/MaterialLibraryClient.tsx b/furniture-3d-system/src/app/asset-center/material-library/MaterialLibraryClient.tsx index 3bc60b89..b44d6c59 100644 --- a/furniture-3d-system/src/app/asset-center/material-library/MaterialLibraryClient.tsx +++ b/furniture-3d-system/src/app/asset-center/material-library/MaterialLibraryClient.tsx @@ -794,7 +794,7 @@ export default function MaterialLibraryClient({
-

基材名称

+

系统名称

{s.name}

diff --git a/furniture-3d-system/src/lib/open-product/substrate-rules.ts b/furniture-3d-system/src/lib/open-product/substrate-rules.ts index 7436ff70..e9be2de8 100644 --- a/furniture-3d-system/src/lib/open-product/substrate-rules.ts +++ b/furniture-3d-system/src/lib/open-product/substrate-rules.ts @@ -21,13 +21,17 @@ export function buildSubstrateDisplayName(params: { finishLabels?: string[] surfaceLabel?: string }): string { - const envLabel = params.environmentGradeLabel.trim() - const envWithSuffix = envLabel ? (envLabel.endsWith('级') ? envLabel : `${envLabel}级`) : '' + const thicknessLabel = `${params.thicknessMm}MM` + const environmentLabel = params.environmentGradeLabel.trim() + const normalizedEnvironment = environmentLabel.endsWith('级') + ? environmentLabel + : `${environmentLabel}级` + return [ - `${params.thicknessMm}`, - envWithSuffix, + thicknessLabel, + normalizedEnvironment, params.categoryLabel.trim(), - ...(params.finishLabels ?? []), + ...(params.finishLabels ?? []).map((item) => item.trim()).filter(Boolean), params.surfaceLabel?.trim() ?? '', ] .filter(Boolean) diff --git a/furniture-3d-system/src/server/repositories/asset-center.repository.ts b/furniture-3d-system/src/server/repositories/asset-center.repository.ts index 0a509ce0..3efa3220 100644 --- a/furniture-3d-system/src/server/repositories/asset-center.repository.ts +++ b/furniture-3d-system/src/server/repositories/asset-center.repository.ts @@ -40,6 +40,7 @@ export interface SubstrateWithRelations extends Substrate { environmentGrade: { id: string; name: string } thicknessSpec: { id: string; name: string; thicknessMm: number; sheetLengthMm: number; sheetWidthMm: number } surfaceOption: { id: string; name: string } | null + systemNameOption: { id: string; name: string } | null finishes: { finish: { id: string @@ -88,6 +89,7 @@ const substrateRelationInclude = { }, }, surfaceOption: { select: { id: true, name: true } }, + systemNameOption: { select: { id: true, name: true } }, finishes: { select: { finish: { diff --git a/furniture-3d-system/src/server/services/asset-center.service.ts b/furniture-3d-system/src/server/services/asset-center.service.ts index 0fff56e6..d8edc5af 100644 --- a/furniture-3d-system/src/server/services/asset-center.service.ts +++ b/furniture-3d-system/src/server/services/asset-center.service.ts @@ -536,7 +536,7 @@ class AssetCenterService { assetType: variant.assetType as AssetThumbnailRenderAssetType, modelUrl, renderBaseUrl, - materialConfig, + ...(materialConfig ? { materialConfig } : {}), }) return this.persistVariantThumbnail(variant, thumbnailUrl, updatedBy) } catch (error) { @@ -774,6 +774,7 @@ class AssetCenterService { select: { id: true, name: true, thicknessMm: true, sheetLengthMm: true, sheetWidthMm: true }, }, surfaceOption: { select: { id: true, name: true } }, + systemNameOption: { select: { id: true, name: true } }, finishes: { include: { finish: { @@ -886,6 +887,7 @@ class AssetCenterService { select: { id: true, name: true, thicknessMm: true, sheetLengthMm: true, sheetWidthMm: true }, }, surfaceOption: { select: { id: true, name: true } }, + systemNameOption: { select: { id: true, name: true } }, finishes: { include: { finish: {