fix: 适配校验页两个 bug
1. buildSnapshot 改用 selectRecentBySiteId(按updated_at取最新配置),不再依赖 is_latest 修复:编辑脚本后保存预览版,buildSnapshot 读到旧脚本导致快照生成失败,发布按钮不出现 2. approveConfig 版本号排序改为 CAST(version AS UNSIGNED) 数值排序 修复:version 是 VARCHAR,字母序导致 '9' > '10',版本号永远过不了 10
This commit is contained in:
@@ -91,12 +91,12 @@ public class AdminController {
|
||||
|
||||
Long reviewerId = (Long) request.getAttribute("accountId");
|
||||
|
||||
// 自动分配版本号:取该站点已审批的最大版本号 + 1
|
||||
// 自动分配版本号:取该站点已审批的最大版本号 + 1(version 是 VARCHAR,需 CAST 数值排序)
|
||||
var latestApproved = siteConfigMapper.selectList(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SiteConfig>()
|
||||
.eq(SiteConfig::getSiteId, config.getSiteId())
|
||||
.eq(SiteConfig::getStatus, ConfigStatus.APPROVED)
|
||||
.orderByDesc(SiteConfig::getVersion));
|
||||
.last("ORDER BY CAST(version AS UNSIGNED) DESC"));
|
||||
int nextVersion = 1;
|
||||
if (!latestApproved.isEmpty()) {
|
||||
try { nextVersion = Integer.parseInt(latestApproved.get(0).getVersion()) + 1; }
|
||||
|
||||
Reference in New Issue
Block a user