admin/src/Oms.Domain/ChannelsAggregate/Repositories/ISalesProductRepository.cs
zzh 6be97e7232
All checks were successful
Build and Deploy / deploy (push) Successful in 1m13s
perf: 加速查价——批量快照、绑定缓存与并行算价
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-26 18:06:49 +08:00

90 lines
4.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Fake.Domain.Repositories;
using Oms.Domain.ChannelsAggregate.Entities;
namespace Oms.Domain.ChannelsAggregate.Repositories;
public interface ISalesProductRepository : IRepository<SalesProduct>
{
Task<SalesProduct?> GetByProductCodeAsync(string productCode, CancellationToken cancellationToken = default);
Task<SalesProduct?> GetByProductCodeIncludingDeletedAsync(
string productCode,
CancellationToken cancellationToken = default);
Task<bool> HasProductCodeAsync(string productCode, CancellationToken cancellationToken = default);
Task<List<SalesProductPrice>> GetPricesAsync(int salesProductId, CancellationToken cancellationToken = default);
Task<SalesProductPrice?> GetPriceByIdAsync(int id, CancellationToken cancellationToken = default);
Task<List<SalesProductPriceFactor>> GetPriceFactorsAsync(IEnumerable<int> priceIds, CancellationToken cancellationToken = default);
Task<List<SalesProductPriceDetail>> GetPriceDetailsAsync(IEnumerable<int> priceIds, CancellationToken cancellationToken = default);
Task<SalesProductPrice> InsertPriceAsync(
SalesProductPrice price,
IEnumerable<SalesProductPriceFactor> factors,
IEnumerable<SalesProductPriceDetail> details,
CancellationToken cancellationToken = default);
Task UpdatePriceAsync(
SalesProductPrice price,
IEnumerable<SalesProductPriceFactor> factors,
IEnumerable<SalesProductPriceDetail> details,
CancellationToken cancellationToken = default);
Task DeletePriceAsync(int id, CancellationToken cancellationToken = default);
Task UpdatePriceStatusAsync(int id, Oms.Domain.Shared.Enums.EnableStatus status, CancellationToken cancellationToken = default);
Task ReplacePricesAsync(
int salesProductId,
IEnumerable<SalesProductPrice> prices,
IEnumerable<SalesProductPriceFactor> factors,
IEnumerable<SalesProductPriceDetail> details,
CancellationToken cancellationToken = default);
Task<List<SalesProductAllocationProvider>> GetAllocationProvidersAsync(int salesProductId, CancellationToken cancellationToken = default);
Task ReplaceAllocationProvidersAsync(int salesProductId, IEnumerable<SalesProductAllocationProvider> providers, CancellationToken cancellationToken = default);
Task<List<SalesProductPublishRecord>> GetPublishRecordsAsync(int salesProductId, string operatorType, int pageIndex, int pageSize, CancellationToken cancellationToken = default);
/// <summary>
/// 发布记录头(不含 Content / AI 报告),供版本号展示。
/// </summary>
Task<List<SalesProductPublishRecord>> GetPublishRecordHeadersAsync(int salesProductId, string operatorType, int pageIndex, int pageSize, CancellationToken cancellationToken = default);
/// <summary>
/// 某产品某类发布记录的全部版本头,不含快照正文。
/// </summary>
Task<List<SalesProductPublishRecord>> GetAllPublishRecordHeadersAsync(int salesProductId, string operatorType, CancellationToken cancellationToken = default);
Task<int> CountPublishRecordsAsync(int salesProductId, string operatorType, CancellationToken cancellationToken = default);
Task<SalesProductPublishRecord> InsertPublishRecordAsync(SalesProductPublishRecord record, CancellationToken cancellationToken = default);
Task<SalesProductPublishRecord?> GetPublishRecordByIdAsync(int id, CancellationToken cancellationToken = default);
Task<SalesProductPublishRecord?> GetPublishRecordByVersionAsync(
int salesProductId,
string operatorType,
string version,
CancellationToken cancellationToken = default);
Task<SalesProductPublishRecord?> GetEffectivePublishRecordAsync(
int salesProductId,
string operatorType,
DateTime bindTime,
CancellationToken cancellationToken = default);
/// <summary>
/// 批量取各产品在 bindTime 时点生效的最新 Active 发布记录(含 Content)。
/// </summary>
Task<Dictionary<int, SalesProductPublishRecord>> GetEffectivePublishRecordsAsync(
IReadOnlyCollection<int> salesProductIds,
string operatorType,
DateTime bindTime,
CancellationToken cancellationToken = default);
}