|
@@ -23,6 +23,7 @@ namespace GxPress.Repository.Implement.Navigation
|
|
|
private readonly Repository<Entity.SystemLabel.SystemLabel> _systemLabelRepository;
|
|
|
private readonly Repository<Entity.tede2.Media.Media> _mediaRepository;
|
|
|
private readonly Repository<Entity.tede2.Media.MediaLable> _mediaLableRepository;
|
|
|
+ private readonly Repository<Entity.Slide> slideRepository;
|
|
|
public NavigationRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
|
|
|
{
|
|
|
_databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
|
|
@@ -35,6 +36,7 @@ namespace GxPress.Repository.Implement.Navigation
|
|
|
_systemLabelRepository = new Repository<Entity.SystemLabel.SystemLabel>(database);
|
|
|
_mediaRepository = new Repository<Entity.tede2.Media.Media>(database);
|
|
|
_mediaLableRepository = new Repository<Entity.tede2.Media.MediaLable>(database);
|
|
|
+ slideRepository = new Repository<Entity.Slide>(database);
|
|
|
_mapper = mapper;
|
|
|
}
|
|
|
|
|
@@ -146,9 +148,9 @@ namespace GxPress.Repository.Implement.Navigation
|
|
|
/// 获取导航栏数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<List<NavigationMediaResult>> GetNavigationResults(int navigationId)
|
|
|
+ public async Task<MiddleLableResult> GetNavigationResults(int navigationId)
|
|
|
{
|
|
|
- var result = new List<NavigationMediaResult>();
|
|
|
+ var result = new MiddleLableResult();
|
|
|
var navigation = await GetAsync(navigationId);
|
|
|
if (navigation.MiddleLableId > 0)
|
|
|
{
|
|
@@ -156,10 +158,16 @@ namespace GxPress.Repository.Implement.Navigation
|
|
|
var middleLable = await _middleLableRepository.GetAsync(navigation.MiddleLableId);
|
|
|
if (string.IsNullOrEmpty(middleLable.LabelId))
|
|
|
return result;
|
|
|
+ result = _mapper.Map<MiddleLableResult>(middleLable);
|
|
|
+ result.NavigationMediaResults = new List<NavigationMediaResult>();
|
|
|
//获取轮播
|
|
|
if (middleLable.IsSlide)
|
|
|
{
|
|
|
- //result
|
|
|
+ if (result.IsSlide)
|
|
|
+ {
|
|
|
+ result.Sildes = await slideRepository.GetAllAsync(Q.Where(nameof(Entity.Slide.TypeId), result.TypeId).Where(nameof(Entity.Slide.IsDisable), false).OrderByDesc(nameof(Entity.Slide.Sort)));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//获取标签
|
|
|
var systemLabels = await _systemLabelRepository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), StringUtils.StringCollectionToIntList(middleLable.LabelId)));
|
|
@@ -195,7 +203,7 @@ namespace GxPress.Repository.Implement.Navigation
|
|
|
{
|
|
|
itemMedia.ImageUrls = StringUtils.AddDomain(itemMedia.ImageUrls);
|
|
|
}
|
|
|
- result.Add(navigationMediaResult);
|
|
|
+ result.NavigationMediaResults.Add(navigationMediaResult);
|
|
|
}
|
|
|
}
|
|
|
return result;
|