mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 02:39:19 +08:00
refactor: 移除商品与规格的 linkName 字段
- 移除 ec_product.link_name 与 ec_product_spec.link_name 列(迁移脚本 V20260507 已执行) - 同步移除后端 DTO/PO/VO/ImportHelper 中对 linkName 的引用
This commit is contained in:
@@ -230,7 +230,6 @@ CREATE TABLE `ec_product` (
|
|||||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
||||||
`category_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '类目ID',
|
`category_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '类目ID',
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
|
||||||
`link_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '链接商品名称',
|
|
||||||
`product_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '商品编码',
|
`product_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '商品编码',
|
||||||
`main_image_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '主图图片ID',
|
`main_image_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '主图图片ID',
|
||||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
@@ -260,7 +259,6 @@ CREATE TABLE `ec_product_spec` (
|
|||||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
||||||
`product_id` bigint UNSIGNED NOT NULL COMMENT '商品ID',
|
`product_id` bigint UNSIGNED NOT NULL COMMENT '商品ID',
|
||||||
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规格名称',
|
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规格名称',
|
||||||
`link_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '链接规格名称',
|
|
||||||
`spec_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规格编码',
|
`spec_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规格编码',
|
||||||
`product_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '商品成本',
|
`product_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '商品成本',
|
||||||
`shipping_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '运费成本',
|
`shipping_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '运费成本',
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- ================================================
|
||||||
|
-- 移除 ec_product / ec_product_spec 的链接名称字段
|
||||||
|
-- ================================================
|
||||||
|
|
||||||
|
ALTER TABLE `ec_product` DROP COLUMN `link_name`;
|
||||||
|
|
||||||
|
ALTER TABLE `ec_product_spec` DROP COLUMN `link_name`;
|
||||||
-4
@@ -225,7 +225,6 @@ public class ProductSpecImportHelper {
|
|||||||
dto.setShippingCost(draft.getShippingCost());
|
dto.setShippingCost(draft.getShippingCost());
|
||||||
dto.setOtherCost(draft.getOtherCost());
|
dto.setOtherCost(draft.getOtherCost());
|
||||||
dto.setRemark(draft.getRemark());
|
dto.setRemark(draft.getRemark());
|
||||||
dto.setLinkName(draft.getLinkName());
|
|
||||||
Long createBy = draft.getCreateBy();
|
Long createBy = draft.getCreateBy();
|
||||||
try {
|
try {
|
||||||
return productSpecService.getById(
|
return productSpecService.getById(
|
||||||
@@ -281,7 +280,6 @@ public class ProductSpecImportHelper {
|
|||||||
spec.setSpecCode(trimmedCode);
|
spec.setSpecCode(trimmedCode);
|
||||||
String finalSpecName = trimmedName != null ? trimmedName : (trimmedCode != null ? trimmedCode : "未知规格");
|
String finalSpecName = trimmedName != null ? trimmedName : (trimmedCode != null ? trimmedCode : "未知规格");
|
||||||
spec.setName(finalSpecName);
|
spec.setName(finalSpecName);
|
||||||
spec.setLinkName(finalSpecName);
|
|
||||||
spec.setProductCost(productCost != null ? productCost : BigDecimal.ZERO);
|
spec.setProductCost(productCost != null ? productCost : BigDecimal.ZERO);
|
||||||
spec.setCreateBy(createBy);
|
spec.setCreateBy(createBy);
|
||||||
spec = insertSpecOrFetchExisting(spec, companyId, context);
|
spec = insertSpecOrFetchExisting(spec, companyId, context);
|
||||||
@@ -318,7 +316,6 @@ public class ProductSpecImportHelper {
|
|||||||
trimmedName != null && !trimmedName.isEmpty() ? trimmedName
|
trimmedName != null && !trimmedName.isEmpty() ? trimmedName
|
||||||
: (trimmedCode != null && !trimmedCode.isEmpty() ? trimmedCode : "未知商品");
|
: (trimmedCode != null && !trimmedCode.isEmpty() ? trimmedCode : "未知商品");
|
||||||
product.setName(resolvedName);
|
product.setName(resolvedName);
|
||||||
product.setLinkName(resolvedName);
|
|
||||||
product.setCreateBy(createBy);
|
product.setCreateBy(createBy);
|
||||||
product = insertProductOrFetchExisting(product, companyId, context);
|
product = insertProductOrFetchExisting(product, companyId, context);
|
||||||
cacheProduct(context, product);
|
cacheProduct(context, product);
|
||||||
@@ -394,7 +391,6 @@ public class ProductSpecImportHelper {
|
|||||||
product = new ProductPO();
|
product = new ProductPO();
|
||||||
product.setCompanyId(companyId);
|
product.setCompanyId(companyId);
|
||||||
product.setName(trimmedName);
|
product.setName(trimmedName);
|
||||||
product.setLinkName(trimmedName);
|
|
||||||
String trimmedCode = productCode != null ? productCode.trim() : "";
|
String trimmedCode = productCode != null ? productCode.trim() : "";
|
||||||
product.setProductCode(trimmedCode.isEmpty() ? "" : trimmedCode);
|
product.setProductCode(trimmedCode.isEmpty() ? "" : trimmedCode);
|
||||||
product.setCreateBy(createBy);
|
product.setCreateBy(createBy);
|
||||||
|
|||||||
-12
@@ -23,12 +23,6 @@ public class CreateProductDTO {
|
|||||||
@NotBlank(message = "商品名称不能为空")
|
@NotBlank(message = "商品名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接商品名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接商品名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品编码
|
* 商品编码
|
||||||
*/
|
*/
|
||||||
@@ -68,12 +62,6 @@ public class CreateProductDTO {
|
|||||||
@NotBlank(message = "规格名称不能为空")
|
@NotBlank(message = "规格名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接规格名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接规格名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格编码
|
* 规格编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-6
@@ -34,12 +34,6 @@ public class CreateProductSpecDTO {
|
|||||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
||||||
private String specCode;
|
private String specCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接规格名称(可选)
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接规格名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品成本
|
* 商品成本
|
||||||
*/
|
*/
|
||||||
|
|||||||
-12
@@ -23,12 +23,6 @@ public class UpdateProductDTO {
|
|||||||
@NotBlank(message = "商品名称不能为空")
|
@NotBlank(message = "商品名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接商品名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接商品名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品编码
|
* 商品编码
|
||||||
*/
|
*/
|
||||||
@@ -80,12 +74,6 @@ public class UpdateProductDTO {
|
|||||||
@NotBlank(message = "规格名称不能为空")
|
@NotBlank(message = "规格名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接规格名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接规格名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格编码
|
* 规格编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-6
@@ -38,12 +38,6 @@ public class ProductPO {
|
|||||||
@TableField("name")
|
@TableField("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接商品名称
|
|
||||||
*/
|
|
||||||
@TableField("link_name")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品编码
|
* 商品编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-6
@@ -39,12 +39,6 @@ public class ProductSpecPO {
|
|||||||
@TableField("name")
|
@TableField("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接规格名称
|
|
||||||
*/
|
|
||||||
@TableField("link_name")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格编码
|
* 规格编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-6
@@ -43,12 +43,6 @@ public class ProductSpecVO {
|
|||||||
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接规格名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接规格名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格编码
|
* 规格编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-6
@@ -43,12 +43,6 @@ public class ProductVO {
|
|||||||
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接商品名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "链接商品名称")
|
|
||||||
private String linkName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品编码
|
* 商品编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
-5
@@ -116,7 +116,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
|||||||
createDto.setShippingCost(specDTO.getShippingCost());
|
createDto.setShippingCost(specDTO.getShippingCost());
|
||||||
createDto.setOtherCost(specDTO.getOtherCost());
|
createDto.setOtherCost(specDTO.getOtherCost());
|
||||||
createDto.setRemark(specDTO.getRemark());
|
createDto.setRemark(specDTO.getRemark());
|
||||||
createDto.setLinkName(specDTO.getLinkName());
|
|
||||||
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
||||||
appendSpecIdIfSpecCodeHasLinkedOrders(companyId, createdVo.getId(), specDTO.getSpecCode(),
|
appendSpecIdIfSpecCodeHasLinkedOrders(companyId, createdVo.getId(), specDTO.getSpecCode(),
|
||||||
specDTO.getProductCost(), specDTO.getShippingCost(), specDTO.getOtherCost(), syncSpecIds);
|
specDTO.getProductCost(), specDTO.getShippingCost(), specDTO.getOtherCost(), syncSpecIds);
|
||||||
@@ -173,7 +172,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
|||||||
createDto.setShippingCost(specDTO.getShippingCost());
|
createDto.setShippingCost(specDTO.getShippingCost());
|
||||||
createDto.setOtherCost(specDTO.getOtherCost());
|
createDto.setOtherCost(specDTO.getOtherCost());
|
||||||
createDto.setRemark(specDTO.getRemark());
|
createDto.setRemark(specDTO.getRemark());
|
||||||
createDto.setLinkName(specDTO.getLinkName());
|
|
||||||
productSpecService.createProductSpecForImport(createDto, companyId, userId);
|
productSpecService.createProductSpecForImport(createDto, companyId, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,9 +395,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
|||||||
createDto.setShippingCost(specDTO.getShippingCost());
|
createDto.setShippingCost(specDTO.getShippingCost());
|
||||||
createDto.setOtherCost(specDTO.getOtherCost());
|
createDto.setOtherCost(specDTO.getOtherCost());
|
||||||
createDto.setRemark(specDTO.getRemark());
|
createDto.setRemark(specDTO.getRemark());
|
||||||
if (specDTO.getLinkName() != null && !specDTO.getLinkName().isBlank()) {
|
|
||||||
createDto.setLinkName(specDTO.getLinkName().trim());
|
|
||||||
}
|
|
||||||
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
||||||
if (Boolean.TRUE.equals(createdVo.getCostChanged()) && createdVo.getId() != null) {
|
if (Boolean.TRUE.equals(createdVo.getCostChanged()) && createdVo.getId() != null) {
|
||||||
rawCostChangedSpecIds.add(createdVo.getId());
|
rawCostChangedSpecIds.add(createdVo.getId());
|
||||||
|
|||||||
-3
@@ -317,9 +317,6 @@ public class ProductSpecServiceImpl extends ServiceImpl<ProductSpecMapper, Produ
|
|||||||
byCode.setShippingCost(dto.getShippingCost());
|
byCode.setShippingCost(dto.getShippingCost());
|
||||||
byCode.setOtherCost(dto.getOtherCost());
|
byCode.setOtherCost(dto.getOtherCost());
|
||||||
byCode.setRemark(dto.getRemark());
|
byCode.setRemark(dto.getRemark());
|
||||||
if (dto.getLinkName() != null && !dto.getLinkName().isBlank()) {
|
|
||||||
byCode.setLinkName(dto.getLinkName().trim());
|
|
||||||
}
|
|
||||||
byCode.setUpdateBy(createByUserId);
|
byCode.setUpdateBy(createByUserId);
|
||||||
this.updateById(byCode);
|
this.updateById(byCode);
|
||||||
relinkOrphanOrdersBySpecCode(companyId, trimmedCode, byCode.getId());
|
relinkOrphanOrdersBySpecCode(companyId, trimmedCode, byCode.getId());
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ export namespace ProductDTO {
|
|||||||
export interface Spec {
|
export interface Spec {
|
||||||
/** 规格名称 */
|
/** 规格名称 */
|
||||||
name: string;
|
name: string;
|
||||||
/** 链接规格名称 */
|
|
||||||
linkName?: string;
|
|
||||||
/** 规格编码 */
|
/** 规格编码 */
|
||||||
specCode?: string;
|
specCode?: string;
|
||||||
/** 商品成本 */
|
/** 商品成本 */
|
||||||
@@ -75,8 +73,6 @@ export namespace ProductDTO {
|
|||||||
id?: number;
|
id?: number;
|
||||||
/** 规格名称 */
|
/** 规格名称 */
|
||||||
name: string;
|
name: string;
|
||||||
/** 链接规格名称 */
|
|
||||||
linkName?: string;
|
|
||||||
/** 规格编码 */
|
/** 规格编码 */
|
||||||
specCode?: string;
|
specCode?: string;
|
||||||
/** 商品成本 */
|
/** 商品成本 */
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ export namespace ProductVO {
|
|||||||
categoryName?: string;
|
categoryName?: string;
|
||||||
/** 商品名称 */
|
/** 商品名称 */
|
||||||
name: string;
|
name: string;
|
||||||
/** 链接商品名称 */
|
|
||||||
linkName?: string;
|
|
||||||
/** 商品编码 */
|
/** 商品编码 */
|
||||||
productCode?: string;
|
productCode?: string;
|
||||||
/** 主图URL */
|
/** 主图URL */
|
||||||
@@ -62,8 +60,6 @@ export namespace ProductVO {
|
|||||||
productName: string;
|
productName: string;
|
||||||
/** 规格名称 */
|
/** 规格名称 */
|
||||||
name: string;
|
name: string;
|
||||||
/** 链接规格名称 */
|
|
||||||
linkName?: string;
|
|
||||||
/** 规格编码 */
|
/** 规格编码 */
|
||||||
specCode?: string;
|
specCode?: string;
|
||||||
/** 商品成本 */
|
/** 商品成本 */
|
||||||
|
|||||||
@@ -680,7 +680,6 @@ onMounted(async () => {
|
|||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div>商品名称:{{ row.product.name }}</div>
|
<div>商品名称:{{ row.product.name }}</div>
|
||||||
<div>链接名称:{{ row.product.linkName || '-' }}</div>
|
|
||||||
<div>商品编码:{{ row.product.productCode || '-' }}</div>
|
<div>商品编码:{{ row.product.productCode || '-' }}</div>
|
||||||
</template>
|
</template>
|
||||||
<a
|
<a
|
||||||
@@ -704,7 +703,6 @@ onMounted(async () => {
|
|||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div>规格名称:{{ row.productSpec.name }}</div>
|
<div>规格名称:{{ row.productSpec.name }}</div>
|
||||||
<div>链接名称:{{ row.productSpec.linkName || '-' }}</div>
|
|
||||||
<div>规格编码:{{ row.productSpec.specCode || '-' }}</div>
|
<div>规格编码:{{ row.productSpec.specCode || '-' }}</div>
|
||||||
</template>
|
</template>
|
||||||
<span style="cursor: default">{{ row.productSpec.name }}</span>
|
<span style="cursor: default">{{ row.productSpec.name }}</span>
|
||||||
|
|||||||
-4
@@ -207,7 +207,6 @@ function initFormData() {
|
|||||||
) {
|
) {
|
||||||
const mapSpec = (spec: ProductVO.SpecInfo) => ({
|
const mapSpec = (spec: ProductVO.SpecInfo) => ({
|
||||||
name: spec.name || spec.specCode || '',
|
name: spec.name || spec.specCode || '',
|
||||||
linkName: spec.linkName || '',
|
|
||||||
specCode: spec.specCode || '',
|
specCode: spec.specCode || '',
|
||||||
productCost: spec.productCost ?? 0,
|
productCost: spec.productCost ?? 0,
|
||||||
shippingCost: spec.shippingCost ?? 0,
|
shippingCost: spec.shippingCost ?? 0,
|
||||||
@@ -294,7 +293,6 @@ async function handleSubmit() {
|
|||||||
_clientKey: _c,
|
_clientKey: _c,
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
linkName,
|
|
||||||
specCode,
|
specCode,
|
||||||
productCost,
|
productCost,
|
||||||
shippingCost,
|
shippingCost,
|
||||||
@@ -303,7 +301,6 @@ async function handleSubmit() {
|
|||||||
} = row;
|
} = row;
|
||||||
const base = {
|
const base = {
|
||||||
name,
|
name,
|
||||||
linkName: linkName || undefined,
|
|
||||||
specCode: specCode ?? '',
|
specCode: specCode ?? '',
|
||||||
productCost: productCost ?? 0,
|
productCost: productCost ?? 0,
|
||||||
shippingCost: shippingCost ?? 0,
|
shippingCost: shippingCost ?? 0,
|
||||||
@@ -442,7 +439,6 @@ function removeNewImage() {
|
|||||||
const defaultSpec = (): SpecFormRow => ({
|
const defaultSpec = (): SpecFormRow => ({
|
||||||
_clientKey: `new-${++nextSpecClientKey}`,
|
_clientKey: `new-${++nextSpecClientKey}`,
|
||||||
name: '',
|
name: '',
|
||||||
linkName: '',
|
|
||||||
specCode: '',
|
specCode: '',
|
||||||
productCost: 0,
|
productCost: 0,
|
||||||
shippingCost: 0,
|
shippingCost: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user