using System; using System.Collections.Generic; using System.Linq; using CNet.DAL; using CNet.Model; namespace CNet.BLL { public partial class BaseServiceDapperContrib where T : class, new() { public IBaseDataDapperContrib dal; //public IBaseDataDapperContrib dal; public BaseServiceDapperContrib(IBaseDataDapperContrib dal) { //dal = BaseDataDapperContribFactory.GetInstance(); this.dal = dal; } /// /// 插入 /// /// /// public long Insert(T model) { return dal.Insert(model); } /// /// 批量插入 /// /// /// public bool InsertBatch(List models) { return dal.InsertBatch(models); } /// /// 更新 /// /// /// public bool Update(T model) { return dal.Update(model); } /// /// 批量更新 /// /// /// public bool UpdateBatch(List models) { return dal.UpdateBatch(models); } /// ///根据实体删除 id必须是int 或 guid /// /// /// public dynamic Delete(T model) { return dal.Delete(model); } /// /// 根据条件删除 /// /// /// public bool DeleteByWhere(string where, object param = null) { return dal.DeleteByWhere(where, param); } /// /// 根据实体删除 id必须是int 或 guid /// /// /// public bool DeleteBatch(List models) { return dal.DeleteBatch(models); } /// /// 获取一个实体对象 /// /// /// public T Get(object id) { return dal.Get(id); } /// /// 获取一个实体对象 /// /// /// public T Get(object id, string keyName) { return dal.Get(id, keyName); } /// /// 根据条件查询实体列表 /// /// 条件 /// 排序 /// 前几条 /// public List GetList(string where, string sort = null, int limits = -1, string fields = " * ", string orderby = "") { return dal.GetList(where, sort, limits, fields, orderby); } /// /// 存储过程分页查询 /// /// /// /// /// /// public PageDateRes GetPage(string where, string sort, int page, int resultsPerPage, string fields = "*") { return dal.GetPage(where, sort, page, resultsPerPage, fields); } public bool ChangeSotpStatus(string where) { return dal.ChangeSotpStatus(where); } } }