refactor: 移除商品与规格的 linkName 字段

- 移除 ec_product.link_name 与 ec_product_spec.link_name 列(迁移脚本 V20260507 已执行)
- 同步移除后端 DTO/PO/VO/ImportHelper 中对 linkName 的引用
This commit is contained in:
小蟑螂
2026-05-07 14:53:56 +08:00
parent 43ea5ce352
commit b695581377
16 changed files with 7 additions and 82 deletions
@@ -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);
@@ -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;
/**
* 规格编码
*/
@@ -34,12 +34,6 @@ public class CreateProductSpecDTO {
@Schema(description = "规格编码", example = "IPHONE15PRO-128G-BLACK")
private String specCode;
/**
* 链接规格名称(可选)
*/
@Schema(description = "链接规格名称")
private String linkName;
/**
* 商品成本
*/
@@ -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;
/**
* 规格编码
*/
@@ -38,12 +38,6 @@ public class ProductPO {
@TableField("name")
private String name;
/**
* 链接商品名称
*/
@TableField("link_name")
private String linkName;
/**
* 商品编码
*/
@@ -39,12 +39,6 @@ public class ProductSpecPO {
@TableField("name")
private String name;
/**
* 链接规格名称
*/
@TableField("link_name")
private String linkName;
/**
* 规格编码
*/
@@ -43,12 +43,6 @@ public class ProductSpecVO {
@Schema(description = "规格名称", example = "128GB 深空黑色")
private String name;
/**
* 链接规格名称
*/
@Schema(description = "链接规格名称")
private String linkName;
/**
* 规格编码
*/
@@ -43,12 +43,6 @@ public class ProductVO {
@Schema(description = "商品名称", example = "iPhone 15 Pro")
private String name;
/**
* 链接商品名称
*/
@Schema(description = "链接商品名称")
private String linkName;
/**
* 商品编码
*/
@@ -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());
@@ -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());