fix: 创建新 draft 前先清理旧 draft,避免旧预览版残留导致版本号显示错误
每次 savePreview/updateSnapshot 插入新 draft 前 deleteBySiteIdAndStatus('draft'),确保每站点最多一个预览版
This commit is contained in:
@@ -138,6 +138,9 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
|
||||
|
||||
int newVersion = snapshotMapper.selectMaxVersion(siteId) + 1;
|
||||
|
||||
// 清理旧 draft(确保一个站点最多一个预览版)
|
||||
snapshotMapper.deleteBySiteIdAndStatus(siteId, "draft");
|
||||
|
||||
SiteSnapshot snapshot = new SiteSnapshot();
|
||||
snapshot.setSiteId(siteId);
|
||||
snapshot.setVersion(newVersion);
|
||||
@@ -181,6 +184,9 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
|
||||
|
||||
int newVersion = snapshotMapper.selectMaxVersion(siteId) + 1;
|
||||
|
||||
// 清理旧 draft(确保一个站点最多一个预览版)
|
||||
snapshotMapper.deleteBySiteIdAndStatus(siteId, "draft");
|
||||
|
||||
SiteSnapshot snapshot = new SiteSnapshot();
|
||||
snapshot.setSiteId(siteId);
|
||||
snapshot.setVersion(newVersion);
|
||||
|
||||
Reference in New Issue
Block a user