mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 00:39:20 +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',
|
||||
`category_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '类目ID',
|
||||
`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 '商品编码',
|
||||
`main_image_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '主图图片ID',
|
||||
`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',
|
||||
`product_id` bigint UNSIGNED NOT NULL COMMENT '商品ID',
|
||||
`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 '规格编码',
|
||||
`product_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.setOtherCost(draft.getOtherCost());
|
||||
dto.setRemark(draft.getRemark());
|
||||
dto.setLinkName(draft.getLinkName());
|
||||
Long createBy = draft.getCreateBy();
|
||||
try {
|
||||
return productSpecService.getById(
|
||||
@@ -281,7 +280,6 @@ public class ProductSpecImportHelper {
|
||||
spec.setSpecCode(trimmedCode);
|
||||
String finalSpecName = trimmedName != null ? trimmedName : (trimmedCode != null ? trimmedCode : "未知规格");
|
||||
spec.setName(finalSpecName);
|
||||
spec.setLinkName(finalSpecName);
|
||||
spec.setProductCost(productCost != null ? productCost : BigDecimal.ZERO);
|
||||
spec.setCreateBy(createBy);
|
||||
spec = insertSpecOrFetchExisting(spec, companyId, context);
|
||||
@@ -318,7 +316,6 @@ public class ProductSpecImportHelper {
|
||||
trimmedName != null && !trimmedName.isEmpty() ? trimmedName
|
||||
: (trimmedCode != null && !trimmedCode.isEmpty() ? trimmedCode : "未知商品");
|
||||
product.setName(resolvedName);
|
||||
product.setLinkName(resolvedName);
|
||||
product.setCreateBy(createBy);
|
||||
product = insertProductOrFetchExisting(product, companyId, context);
|
||||
cacheProduct(context, product);
|
||||
@@ -394,7 +391,6 @@ public class ProductSpecImportHelper {
|
||||
product = new ProductPO();
|
||||
product.setCompanyId(companyId);
|
||||
product.setName(trimmedName);
|
||||
product.setLinkName(trimmedName);
|
||||
String trimmedCode = productCode != null ? productCode.trim() : "";
|
||||
product.setProductCode(trimmedCode.isEmpty() ? "" : trimmedCode);
|
||||
product.setCreateBy(createBy);
|
||||
|
||||
-12
@@ -23,12 +23,6 @@ public class CreateProductDTO {
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接商品名称
|
||||
*/
|
||||
@Schema(description = "链接商品名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@@ -68,12 +62,6 @@ public class CreateProductDTO {
|
||||
@NotBlank(message = "规格名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接规格名称
|
||||
*/
|
||||
@Schema(description = "链接规格名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
|
||||
-6
@@ -34,12 +34,6 @@ public class CreateProductSpecDTO {
|
||||
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
|
||||
private String specCode;
|
||||
|
||||
/**
|
||||
* 链接规格名称(可选)
|
||||
*/
|
||||
@Schema(description = "链接规格名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 商品成本
|
||||
*/
|
||||
|
||||
-12
@@ -23,12 +23,6 @@ public class UpdateProductDTO {
|
||||
@NotBlank(message = "商品名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接商品名称
|
||||
*/
|
||||
@Schema(description = "链接商品名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@@ -80,12 +74,6 @@ public class UpdateProductDTO {
|
||||
@NotBlank(message = "规格名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接规格名称
|
||||
*/
|
||||
@Schema(description = "链接规格名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
|
||||
-6
@@ -38,12 +38,6 @@ public class ProductPO {
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接商品名称
|
||||
*/
|
||||
@TableField("link_name")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
|
||||
-6
@@ -39,12 +39,6 @@ public class ProductSpecPO {
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接规格名称
|
||||
*/
|
||||
@TableField("link_name")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
|
||||
-6
@@ -43,12 +43,6 @@ public class ProductSpecVO {
|
||||
@Schema(description = "规格名称", example = "128GB 深空黑色")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 链接规格名称
|
||||
*/
|
||||
@Schema(description = "链接规格名称")
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 规格编码
|
||||
*/
|
||||
|
||||
-6
@@ -43,12 +43,6 @@ public class ProductVO {
|
||||
@Schema(description = "商品名称", example = "iPhone 15 Pro")
|
||||
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.setOtherCost(specDTO.getOtherCost());
|
||||
createDto.setRemark(specDTO.getRemark());
|
||||
createDto.setLinkName(specDTO.getLinkName());
|
||||
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
||||
appendSpecIdIfSpecCodeHasLinkedOrders(companyId, createdVo.getId(), specDTO.getSpecCode(),
|
||||
specDTO.getProductCost(), specDTO.getShippingCost(), specDTO.getOtherCost(), syncSpecIds);
|
||||
@@ -173,7 +172,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
createDto.setShippingCost(specDTO.getShippingCost());
|
||||
createDto.setOtherCost(specDTO.getOtherCost());
|
||||
createDto.setRemark(specDTO.getRemark());
|
||||
createDto.setLinkName(specDTO.getLinkName());
|
||||
productSpecService.createProductSpecForImport(createDto, companyId, userId);
|
||||
}
|
||||
}
|
||||
@@ -397,9 +395,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
createDto.setShippingCost(specDTO.getShippingCost());
|
||||
createDto.setOtherCost(specDTO.getOtherCost());
|
||||
createDto.setRemark(specDTO.getRemark());
|
||||
if (specDTO.getLinkName() != null && !specDTO.getLinkName().isBlank()) {
|
||||
createDto.setLinkName(specDTO.getLinkName().trim());
|
||||
}
|
||||
ProductSpecVO createdVo = productSpecService.createProductSpec(createDto);
|
||||
if (Boolean.TRUE.equals(createdVo.getCostChanged()) && createdVo.getId() != null) {
|
||||
rawCostChangedSpecIds.add(createdVo.getId());
|
||||
|
||||
-3
@@ -317,9 +317,6 @@ public class ProductSpecServiceImpl extends ServiceImpl<ProductSpecMapper, Produ
|
||||
byCode.setShippingCost(dto.getShippingCost());
|
||||
byCode.setOtherCost(dto.getOtherCost());
|
||||
byCode.setRemark(dto.getRemark());
|
||||
if (dto.getLinkName() != null && !dto.getLinkName().isBlank()) {
|
||||
byCode.setLinkName(dto.getLinkName().trim());
|
||||
}
|
||||
byCode.setUpdateBy(createByUserId);
|
||||
this.updateById(byCode);
|
||||
relinkOrphanOrdersBySpecCode(companyId, trimmedCode, byCode.getId());
|
||||
|
||||
Reference in New Issue
Block a user