using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FlexJobApi.Core
{
///
/// 任务仓库
///
public static class TaskInfoRepository
{
///
/// 获取任务查询
///
///
///
///
///
public static IQueryable GetQueryable(this IRepository rep, bool tracking = true, CurrentLogier logier = null)
{
logier = logier ?? JwtUtils.GetCurrentLogier();
var q = rep.AsQueryable();
if (tracking)
{
q = q.AsNoTracking();
}
q = q.OrderByDescending(it => it.CreatedTime);
if (logier != null && logier.Type == EnumUserType.Enterprise)
{
q = q.Where(it => it.EnterpriseId == logier.EnterpriseId);
}
return q;
}
}
}