using Common.Models;
using Services.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Services.BLL
{
public class CommonBLL
{
private CommonDAL dal = new CommonDAL();
#region 查询
///
/// 分页查询-Lambda
///
///
///
///
///
public PaginationDTO> FindPageList(Expression> condition, PaginationQuery pagination) where T : class, new()
{
return dal.FindPageList(condition, pagination);
}
///
/// 集合查询(Lambda)
///
///
///
///
public IEnumerable FindList(Expression> condition) where T : class, new()
{
return dal.FindList(condition);
}
///
/// 集合查询(Lambda)
///
///
///
///
public T FindEntity(Expression> condition) where T : class, new()
{
return dal.FindEntity(condition);
}
///
/// 数据条数
///
///
///
///
public int Count(Expression> condition) where T : class, new()
{
return dal.Count(condition);
}
#endregion
#region sql查询
///
/// sql 分页集合查询
///
///
///
///
public PaginationDTO> FindPageList(string sql, PaginationQuery pagination, object para = null) where T : class, new()
{
return dal.FindPageList(sql, pagination, para);
}
///
/// sql查询
///
///
///
///
public T FindEntity(string sql, object para = null) where T : class, new()
{
return dal.FindEntity(sql, para);
}
///
/// sql 数据集查询
///
///
///
///
///
public IEnumerable FindList(string sql, object para = null) where T : class, new()
{
return dal.FindList(sql, para);
}
#endregion
#region 编辑
///
/// 实体新增
///
/// sql语句
/// 参数化
public int Insert(T model) where T : class, new()
{
return dal.Insert(model);
}
///
/// 批量实体新增
///
/// sql语句
/// 参数化
public int Insert(List list) where T : class, new()
{
return dal.Insert(list);
}
///
/// 修改
///
///
///
///
public int Update(T model) where T : class, new()
{
return dal.Update(model);
}
#endregion
#region 删除
///
/// 删除
///
///
///
///
public int Delete(T model) where T : class, new()
{
return dal.Delete(model);
}
///
/// 删除
///
///
///
///
public int DeleteById(int id) where T : class, new()
{
return dal.Delete(id);
}
#endregion
}
}