|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using GDZZ.Application.Entity;
|
|
|
|
using GDZZ.Application.Entity;
|
|
|
|
using GDZZ.Core.Entity;
|
|
|
|
using GDZZ.Core.Entity;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GDZZ.Application
|
|
|
|
namespace GDZZ.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -18,10 +19,12 @@ namespace GDZZ.Application
|
|
|
|
public class CourseService : ICourseService, IDynamicApiController, ITransient
|
|
|
|
public class CourseService : ICourseService, IDynamicApiController, ITransient
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly SqlSugarRepository<Course> _rep;
|
|
|
|
private readonly SqlSugarRepository<Course> _rep;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<SysFile> sysFileRep;
|
|
|
|
|
|
|
|
|
|
|
|
public CourseService(SqlSugarRepository<Course> rep)
|
|
|
|
public CourseService(SqlSugarRepository<Course> rep, SqlSugarRepository<SysFile> sysFileRep)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_rep = rep;
|
|
|
|
_rep = rep;
|
|
|
|
|
|
|
|
this.sysFileRep = sysFileRep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -33,21 +36,11 @@ namespace GDZZ.Application
|
|
|
|
public async Task<dynamic> Page([FromQuery] CourseInput input)
|
|
|
|
public async Task<dynamic> Page([FromQuery] CourseInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
.InnerJoin<SysFile>((n, u) => n.FileID == u.Id)
|
|
|
|
.Includes(x=>x.SysFiles)
|
|
|
|
|
|
|
|
.Where(x=>x.SysFiles.Any(z=>z.FileSuffix == "mp4"))
|
|
|
|
.WhereIF(!UserManager.IsTenantAdmin, n => n.CreatedUserId == UserManager.UserId)
|
|
|
|
.WhereIF(!UserManager.IsTenantAdmin, n => n.CreatedUserId == UserManager.UserId)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Tags), n => n.Tags == input.Tags)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Tags), n => n.Tags == input.Tags)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Title), n => n.Title == input.Title)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Title), n => n.Title == input.Title)
|
|
|
|
.Select((n, u) => new CourseOutput
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FileID = u.Id,
|
|
|
|
|
|
|
|
Id = n.Id,
|
|
|
|
|
|
|
|
Info = n.Info,
|
|
|
|
|
|
|
|
Price = n.Price,
|
|
|
|
|
|
|
|
Tags = n.Tags,
|
|
|
|
|
|
|
|
Title = n.Title,
|
|
|
|
|
|
|
|
Url = n.Url,
|
|
|
|
|
|
|
|
VoiderUrl = "/"+u.FilePath+"/"+u.FileObjectName
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -57,7 +50,7 @@ namespace GDZZ.Application
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("/Mini/Course/page")]
|
|
|
|
[HttpPost("/Mini/Course/add")]
|
|
|
|
public async Task Add(AddCourseInput input)
|
|
|
|
public async Task Add(AddCourseInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var entity = input.Adapt<Course>();
|
|
|
|
var entity = input.Adapt<Course>();
|
|
|
|