|
@@ -104,6 +104,19 @@ namespace CallCenter.Repository.SqlSugar
|
|
|
return await Db.Queryable<TEntity>().FirstAsync(predicate);
|
|
|
}
|
|
|
|
|
|
+ public async Task<TEntity?> GetAsync(Expression<Func<TEntity, bool>> predicate,bool isDesc, Expression<Func<TEntity, object>> orderby, CancellationToken cancellationToken = default)
|
|
|
+ {
|
|
|
+ if (isDesc)
|
|
|
+ {
|
|
|
+ return await Db.Queryable<TEntity>().OrderBy(orderby, OrderByType.Desc).FirstAsync(predicate);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return await Db.Queryable<TEntity>().OrderBy(orderby,OrderByType.Asc).FirstAsync(predicate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public async Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>>? predicate = null, params (bool isWhere, Expression<Func<TEntity, bool>> expression)[] whereIfs)
|
|
|
{
|
|
|
var query = Db.Queryable<TEntity>().Where(predicate ??= d => true);
|