using InterfaceForward.Repositories.Interface.Entitys; using InterfaceForward.Repositories.Interface.ValueObjects; namespace InterfaceForward.Repositories.Interface.Services; public class InterfaceMapPublishRepository : BasicRepository, IInterfaceMapPublishRepository, IScopedDependency { public async Task> GetPublishedListAsync(int interfaceId, int serviceProviderId, int pageIndex, int pageSize) { return await Context.Queryable() //.LeftJoin((a, b) => a.CreateUserId == b.Id) .Where(a => a.InterfaceId == interfaceId && a.ServiceProviderId == serviceProviderId) .OrderByDescending(a => a.CreateTime) .Select((a) => new InterfaceMapPublishedOutPutVO { Id = a.Id, PublishedVersion = a.PublishedVersion, PublishedContent = a.PublishedContent, PrePublishedVersion = a.PrePublishedVersion, DifferenceContent = a.DifferenceContent, //PublishUser = b.Name, PublishTime = a.CreateTime, OperatorType = a.IsPublished ? "发布" : "回滚", Description = a.Description }) .ToPageListAsync(pageIndex, pageSize); } public async Task GetPublishContentAsync(int interfaceId, int serviceProviderId, string version) { return await Context.Queryable() .Where(a => a.InterfaceId == interfaceId && a.ServiceProviderId == serviceProviderId && a.PublishedVersion == version) .Select(a => a.PublishedContent) .FirstAsync(); } } public interface IInterfaceMapPublishRepository : IBasicRepository { /// /// 获取接口映射发布记录 /// /// 系统接口Id /// 服务商Id /// /// /// Task> GetPublishedListAsync(int interfaceId, int serviceProviderId, int pageIndex, int pageSize); }