增加获取最新版本接口

This commit is contained in:
lihanbo 2024-10-18 11:33:00 +08:00
parent b5e1badf07
commit cb1ef1db08
1 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using LFlow.Base.Default;
using LFlow.Base.Utils;
using LFlow.VersionManagement.Enums;
using LFlow.VersionManagement.Model;
using SqlSugar;
@ -20,4 +21,14 @@ public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<Version
.Select(x => x.ID)
.ToList();
}
public VersionModel GetLatestVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
{
return db.Queryable<VersionModel>()
.Where(mt => type == mt.VersionType && channel == mt.VersionChannel && targetType == mt.UpgradeTargetType)
.GroupBy(mt => mt.CurrentVersion)
.OrderBy(mt => mt.LastPublishTime, OrderByType.Desc)
.First();
}
}