105040 Update
This commit is contained in:
parent
250ba4a01a
commit
5ed583a006
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"Urls": "https://127.0.0.1:8443;http://127.0.0.1:8088",
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
|
|
|
@ -68,8 +68,8 @@ public class VersionManagementController(IVersionManagementService service) : Ba
|
|||
|
||||
//}
|
||||
[HttpGet]
|
||||
public ApiResult<VersionDto> GetLastUpdate(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
|
||||
public ApiResult<VersionDto> GetLastUpdate(VersionChannel channel, UpgradeTargetType targetType)
|
||||
{
|
||||
return ApiResult<VersionDto>.SuccessResult(service.GetLastVersion(type, channel, targetType));
|
||||
return ApiResult<VersionDto>.SuccessResult(service.GetLastVersion(channel, targetType));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,12 +7,22 @@ using SqlSugar;
|
|||
namespace LFlow.VersionManagement.Repository;
|
||||
public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<VersionModel, string>(db)
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据条件搜索
|
||||
/// </summary>
|
||||
/// <param name="whereObj"></param>
|
||||
/// <returns></returns>
|
||||
public override List<VersionModel> Search(VersionModel whereObj)
|
||||
{
|
||||
return db.Queryable<VersionModel>()
|
||||
.Where(whereObj.ToWhereExp())
|
||||
.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据条件搜索ID
|
||||
/// </summary>
|
||||
/// <param name="whereObj"></param>
|
||||
/// <returns></returns>
|
||||
public override List<string> WhereSearchId(VersionModel whereObj)
|
||||
{
|
||||
return db.Queryable<VersionModel>()
|
||||
|
@ -21,11 +31,16 @@ public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<Version
|
|||
.Select(x => x.ID)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public VersionModel GetLatestVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
|
||||
/// <summary>
|
||||
/// 获取最新版本
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="targetType"></param>
|
||||
/// <returns></returns>
|
||||
public VersionModel GetLatestVersion(VersionChannel channel, UpgradeTargetType targetType)
|
||||
{
|
||||
return db.Queryable<VersionModel>()
|
||||
.Where(mt => type == mt.VersionType && channel == mt.VersionChannel && targetType == mt.UpgradeTargetType)
|
||||
.Where(mt => channel == mt.VersionChannel && targetType == mt.UpgradeTargetType)
|
||||
.GroupBy(mt => mt.CurrentVersion)
|
||||
.OrderBy(mt => mt.LastPublishTime, OrderByType.Desc)
|
||||
.First();
|
||||
|
|
|
@ -13,5 +13,5 @@ public interface IVersionManagementService : IService//<VersionDto>
|
|||
|
||||
List<VersionDto> GetAll(int pageIndex, int pageSize, ref int total);
|
||||
|
||||
VersionDto? GetLastVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType);
|
||||
VersionDto? GetLastVersion(VersionChannel channel, UpgradeTargetType targetType);
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ public class VersionManagementService : IVersionManagementService
|
|||
// 搜索需要增加分页
|
||||
public List<VersionDto> Search(VersionDto whereObj)
|
||||
=> _repo.Search(whereObj.Adapt<VersionModel>()).Adapt<List<VersionDto>>();
|
||||
public VersionDto? GetLastVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
|
||||
public VersionDto? GetLastVersion(VersionChannel channel, UpgradeTargetType targetType)
|
||||
{
|
||||
if (_repo is VersionManagementRepo versionRepo)
|
||||
{
|
||||
return versionRepo.GetLatestVersion(type, channel, targetType).Adapt<VersionDto>();
|
||||
return versionRepo.GetLatestVersion(channel, targetType).Adapt<VersionDto>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue