You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.3 KiB

using zzz.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace zzz.Services
{
/// <summary>
/// 服务接口
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public interface IBaseServices<TEntity> where TEntity : class
{
/// <summary>
/// 根据主键取数据
/// </summary>
/// <typeparam name="Tout"></typeparam>
/// <typeparam name="Tkey"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
Task<Tout> GetOneById<Tout,Tkey>(Tkey key) where Tout : class, new();
/// <summary>
/// 取分页数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="whereExpression"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="orderByFields"></param>
/// <returns></returns>
Task<PageModel<T>> GetPageList<T>(
Expression<Func<T, bool>> whereExpression,
int pageIndex = 1,
int pageSize = 20,
string orderByFields = null);
/// <summary>
/// 新增 实体
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<bool> AddOne(TEntity entity);
/// <summary>
/// 新增
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> AddOne<TAddDto, Tkey>(TAddDto input)
where Tkey : IEquatable<Tkey>
//where TAdd : RootEntityTkey<Tkey>
;
/// <summary>
/// 编辑
/// </summary>
/// <param name="input"></param>
/// <param name="key"></param>
/// <returns></returns>
Task<bool> UpdOne<TUpdDto, Tkey>(TUpdDto input)
where Tkey : IEquatable<Tkey>
//where TUpd : RootEntityTkey<Tkey>
;
/// <summary>
/// 删除
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
Task<bool> DelOneSoft<TDel, Tkey>(KeyInputUpd<Tkey> key)
where Tkey : IEquatable<Tkey>
where TDel : RootEntityTkey<Tkey>
;
}
}