增加建立新版本

This commit is contained in:
wuweihua
2026-10-28 21:42:45 +08:00
parent 00a690abe9
commit 1eb0e45513
8 changed files with 109 additions and 28 deletions
@@ -29,7 +29,10 @@ public class PrcPriceSetVersion extends BaseEntity
/** 0 draft / 3 pending / 1 active / 2 expired */
private String status;
/**
* Create-price mode for this version: PULL = from product library, IMPORT = Excel.
* Create-price mode for this version:
* PULL = from product library,
* IMPORT = Excel with prior version preload,
* IMPORT_FRESH = Excel without prior version data.
* Column: price_build_mode
*/
private String priceBuildMode;
@@ -3361,9 +3361,10 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
}
/**
* Draft only: when priceBuildMode changes (PULL/IMPORT), delete this version's
* Draft only: when priceBuildMode changes (PULL/IMPORT/IMPORT_FRESH), delete this version's
* product / detail / SALES surcharge rel rows. Same mode or non-draft: no-op.
* IMPORT: after wipe, copy products+details from latest prior version (if any).
* IMPORT_FRESH: wipe only, do not copy prior version (blank Excel build).
*/
private void clearDraftVersionChildrenIfBuildModeChanged(PrcPriceSetVersion db, PrcPriceSetVersion incoming)
{
@@ -3387,6 +3388,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
}
Long psvId = db.getPsvId();
wipeVersionChildren(psvId, db.getStatus());
// IMPORT inherits prior version; IMPORT_FRESH starts empty for Excel import
if ("IMPORT".equalsIgnoreCase(newMode))
{
copyLatestPriorVersionChildren(db.getPriceSetId(), psvId);
+1 -1
View File
@@ -1314,7 +1314,7 @@ CREATE TABLE `prc_price_set_version` (
`effective_time` datetime DEFAULT NULL COMMENT '生效时间',
`expire_time` datetime DEFAULT NULL COMMENT '失效时间(空=长期;下一版本启动时写入该启动时间)',
`status` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '0 draft 3 pending 1 effect 2 expired',
`price_build_mode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建价格方式 PULL=拉取产品库 IMPORT=Excel导入',
`price_build_mode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建价格方式 PULL=拉取产品库 IMPORT=Excel继承上一版 IMPORT_FRESH=Excel重新建价',
`is_del` char(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1已删除',
`created_by` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
@@ -1,3 +1,3 @@
-- Add create-price mode on package version: PULL / IMPORT
ALTER TABLE prc_price_set_version
ADD COLUMN price_build_mode varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建价格方式 PULL=拉取产品库 IMPORT=Excel导入' AFTER status;
ADD COLUMN price_build_mode varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建价格方式 PULL=拉取产品库 IMPORT=Excel继承上一版 IMPORT_FRESH=Excel重新建价' AFTER status;