diff --git a/LFlow.VersionManagement/Repository/VersionManagementRepo.cs b/LFlow.VersionManagement/Repository/VersionManagementRepo.cs index 818baad..0e838dc 100644 --- a/LFlow.VersionManagement/Repository/VersionManagementRepo.cs +++ b/LFlow.VersionManagement/Repository/VersionManagementRepo.cs @@ -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 x.ID) .ToList(); } + + public VersionModel GetLatestVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType) + { + return db.Queryable() + .Where(mt => type == mt.VersionType && channel == mt.VersionChannel && targetType == mt.UpgradeTargetType) + .GroupBy(mt => mt.CurrentVersion) + .OrderBy(mt => mt.LastPublishTime, OrderByType.Desc) + .First(); + + } }