fix(ecom): 移除推广费表的platform_id字段及外键约束

- ec_design.sql 移除 platform_id 字段及约束
- 实体/DTO/VO 同步移除 platformId / platformName
- PromotionFeeServiceImpl 移除 PlatformService 依赖和平台名称填充逻辑
- 数据库已同步更新
This commit is contained in:
小蟑螂
2026-05-06 02:18:03 +08:00
parent 98a4c4293f
commit 7bcf97fcc3
7 changed files with 1 additions and 54 deletions
-3
View File
@@ -294,7 +294,6 @@ CREATE TABLE `ec_promotion_fee` (
`shop_id` bigint UNSIGNED NOT NULL COMMENT '店铺ID',
`product_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '商品ID(可选)',
`fee_type_id` bigint UNSIGNED NOT NULL COMMENT '推广费类型ID',
`platform_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '平台ID',
`campaign_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推广活动名称',
`fee_amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '推广费金额',
`fee_date` date NOT NULL COMMENT '推广费发生日期',
@@ -309,14 +308,12 @@ CREATE TABLE `ec_promotion_fee` (
INDEX `idx_product_id`(`product_id` ASC) USING BTREE,
INDEX `idx_fee_type_id`(`fee_type_id` ASC) USING BTREE,
INDEX `idx_fee_date`(`fee_date` ASC) USING BTREE,
INDEX `idx_platform_id`(`platform_id` ASC) USING BTREE,
INDEX `fk_ec_promotion_fee_creator`(`create_by` ASC) USING BTREE,
INDEX `fk_ec_promotion_fee_updater`(`update_by` ASC) USING BTREE,
CONSTRAINT `fk_ec_promotion_fee_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_shop` FOREIGN KEY (`shop_id`) REFERENCES `ec_shop` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_product` FOREIGN KEY (`product_id`) REFERENCES `ec_product` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_platform` FOREIGN KEY (`platform_id`) REFERENCES `ec_platform` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_type` FOREIGN KEY (`fee_type_id`) REFERENCES `ec_promotion_fee_type` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_ec_promotion_fee_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '电商-推广费记录表' ;
@@ -28,12 +28,6 @@ public class CreatePromotionFeeDTO {
@NotNull(message = "推广费类型ID不能为空")
private Long feeTypeId;
/**
* 平台ID
*/
@Schema(description = "平台ID", example = "1")
private Long platformId;
/**
* 商品ID(可选,关联到具体商品)
*/
@@ -24,12 +24,6 @@ public class PromotionFeeFilterDTO {
@Schema(description = "推广费类型ID", example = "1")
private Long feeTypeId;
/**
* 平台ID
*/
@Schema(description = "平台ID", example = "1")
private Long platformId;
/**
* 商品ID(可选)
*/
@@ -35,12 +35,6 @@ public class UpdatePromotionFeeDTO {
@NotNull(message = "推广费类型ID不能为空")
private Long feeTypeId;
/**
* 平台ID
*/
@Schema(description = "平台ID", example = "1")
private Long platformId;
/**
* 商品ID(可选,关联到具体商品)
*/
@@ -40,12 +40,6 @@ public class PromotionFeePO {
@TableField("fee_type_id")
private Long feeTypeId;
/**
* 平台ID
*/
@TableField("platform_id")
private Long platformId;
/**
* 商品ID(可选)
*/
@@ -50,18 +50,6 @@ public class PromotionFeeVO {
@Schema(description = "推广费类型名称", example = "直通车")
private String feeTypeName;
/**
* 平台ID
*/
@Schema(description = "平台ID", example = "1")
private Long platformId;
/**
* 平台名称
*/
@Schema(description = "平台名称", example = "淘宝")
private String platformName;
/**
* 商品ID(可选)
*/
@@ -36,7 +36,7 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
private final CurrentUserContext currentUserContext;
private final ShopService shopService;
private final PromotionFeeTypeService promotionFeeTypeService;
private final PlatformService platformService;
/**
* 创建推广费记录
@@ -127,9 +127,6 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
if (filter.getFeeTypeId() != null) {
wrapper.eq(PromotionFeePO::getFeeTypeId, filter.getFeeTypeId());
}
if (filter.getPlatformId() != null) {
wrapper.eq(PromotionFeePO::getPlatformId, filter.getPlatformId());
}
if (filter.getProductId() != null) {
wrapper.eq(PromotionFeePO::getProductId, filter.getProductId());
}
@@ -182,17 +179,6 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
}
}
// 填充平台名称
if (po.getPlatformId() != null) {
try {
var platform = platformService.getById(po.getPlatformId());
if (platform != null) {
vo.setPlatformName(platform.getPlatformName());
}
} catch (Exception ignored) {
}
}
return vo;
}
}