38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using New_College.IRepository;
|
|
using New_College.IRepository.UnitOfWork;
|
|
using New_College.Model.Models;
|
|
using New_College.Model.ViewModels;
|
|
using New_College.Repository.Base;
|
|
using SqlSugar;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace New_College.Repository
|
|
{
|
|
/// <summary>
|
|
/// D_MajorRepository
|
|
/// </summary>
|
|
public class D_MajorRepository : BaseRepository<D_Major>, ID_MajorRepository
|
|
{
|
|
public D_MajorRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
|
{
|
|
}
|
|
|
|
public async Task<List<SeachMajorDtoResponse>> SeachMajor(SeachMajorDtoRequest request)
|
|
{
|
|
|
|
var query = await this.Db.Queryable<D_Major,D_MajorClass, D_MajorCategory>((c,b,a) => new object[] { JoinType.Left, b.Id == c.CategoryClass_Id,JoinType.Left, a.Id == b.TradeId })
|
|
.Where((c, b, a) => c.MajorName.Contains(request.Name))
|
|
.Select((c, b, a) => new SeachMajorDtoResponse
|
|
{
|
|
Code = c.MajorCode,
|
|
Id = c.Id,
|
|
Name = c.Name,
|
|
Type = a.Type,
|
|
}).ToListAsync();
|
|
|
|
|
|
return query;
|
|
}
|
|
}
|
|
} |