Files
1440WGJ/JY.DAL/Repository/IRepository.cs
T

42 lines
1.1 KiB
C#
Raw Normal View History

2026-07-14 13:55:17 +08:00
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace JY.DAL.Repository
{
public interface IRepository<T> where T : class, new()
{
ISqlSugarClient Db { get; }
T GetById(object id);
T GetSingle(Expression<Func<T, bool>> predicate);
List<T> GetList();
List<T> GetList(Expression<Func<T, bool>> predicate);
List<T> GetListPaged(int pageIndex, int pageSize, out int totalCount, Expression<Func<T, bool>> predicate = null, string orderBy = null);
int Insert(T entity);
int Insert(List<T> entities);
int Update(T entity);
int Update(T entity, Expression<Func<T, bool>> whereExpression);
int Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
int Delete(object id);
int Delete(Expression<Func<T, bool>> predicate);
int Delete(List<T> entities);
bool Any(Expression<Func<T, bool>> predicate);
int Count(Expression<Func<T, bool>> predicate = null);
}
}