mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
新增文档分类列表树
This commit is contained in:
@ -6,85 +6,85 @@ using System.Linq.Expressions;
|
||||
|
||||
namespace FreeSql.Site.DAL
|
||||
{
|
||||
public class DocumentContentDAL
|
||||
public class DocumentContentDAL : BaseDAL<DocumentContent>
|
||||
{
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public long Insert(DocumentContent model)
|
||||
{
|
||||
return DataBaseType.MySql.DB().Insert<DocumentContent>(model).ExecuteIdentity();
|
||||
}
|
||||
///// <summary>
|
||||
///// 新增
|
||||
///// </summary>
|
||||
///// <param name="model"></param>
|
||||
///// <returns></returns>
|
||||
//public long Insert(DocumentContent model)
|
||||
//{
|
||||
// return DataBaseType.MySql.DB().Insert<DocumentContent>(model).ExecuteIdentity();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public bool Update(DocumentContent model)
|
||||
{
|
||||
var runsql = DataBaseType.MySql.DB().Update<DocumentContent>().SetSource(model);
|
||||
return runsql.ExecuteAffrows() > 0;
|
||||
}
|
||||
///// <summary>
|
||||
///// 修改
|
||||
///// </summary>
|
||||
///// <param name="model"></param>
|
||||
///// <returns></returns>
|
||||
//public bool Update(DocumentContent model)
|
||||
//{
|
||||
// var runsql = DataBaseType.MySql.DB().Update<DocumentContent>().SetSource(model);
|
||||
// return runsql.ExecuteAffrows() > 0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public bool Delete(long id)
|
||||
{
|
||||
return DataBaseType.MySql.DB().Delete<DocumentContent>(id).ExecuteDeleted().Count > 0;
|
||||
}
|
||||
///// <summary>
|
||||
///// 删除
|
||||
///// </summary>
|
||||
///// <param name="id"></param>
|
||||
///// <returns></returns>
|
||||
//public bool Delete(long id)
|
||||
//{
|
||||
// return DataBaseType.MySql.DB().Delete<DocumentContent>(id).ExecuteDeleted().Count > 0;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条数据
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <returns></returns>
|
||||
public DocumentContent GetByOne(Expression<Func<DocumentContent, bool>> where)
|
||||
{
|
||||
return DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
.Where(where).ToOne();
|
||||
}
|
||||
///// <summary>
|
||||
///// 获取一条数据
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <returns></returns>
|
||||
//public DocumentContent GetByOne(Expression<Func<DocumentContent, bool>> where)
|
||||
//{
|
||||
// return DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
// .Where(where).ToOne();
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条数据
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <returns></returns>
|
||||
public long Count(Expression<Func<DocumentContent, bool>> where)
|
||||
{
|
||||
return DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
.Where(where).Count();
|
||||
}
|
||||
///// <summary>
|
||||
///// 获取一条数据
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <returns></returns>
|
||||
//public long Count(Expression<Func<DocumentContent, bool>> where)
|
||||
//{
|
||||
// return DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
// .Where(where).Count();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 查询功能
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <param name="orderby"></param>
|
||||
/// <returns></returns>
|
||||
public (List<DocumentContent> list, long count) Query(Expression<Func<DocumentContent, bool>> where,
|
||||
Expression<Func<DocumentContent, DocumentContent>> orderby = null, PageInfo pageInfo = null)
|
||||
{
|
||||
//设置查询条件
|
||||
var list = DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
.Where(where);
|
||||
///// <summary>
|
||||
///// 查询功能
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <param name="orderby"></param>
|
||||
///// <returns></returns>
|
||||
//public (List<DocumentContent> list, long count) Query(Expression<Func<DocumentContent, bool>> where,
|
||||
// Expression<Func<DocumentContent, DocumentContent>> orderby = null, PageInfo pageInfo = null)
|
||||
//{
|
||||
// //设置查询条件
|
||||
// var list = DataBaseType.MySql.DB().Select<DocumentContent>()
|
||||
// .Where(where);
|
||||
|
||||
//设置排序
|
||||
if (orderby != null) list = list.OrderBy(b => b.CreateDt);
|
||||
// //设置排序
|
||||
// if (orderby != null) list = list.OrderBy(b => b.CreateDt);
|
||||
|
||||
var count = list.Count();
|
||||
//设置分页操作
|
||||
if (pageInfo != null && pageInfo.IsPaging)
|
||||
list.Skip(pageInfo.PageIndex * pageInfo.PageSize).Limit(pageInfo.PageSize);
|
||||
// var count = list.Count();
|
||||
// //设置分页操作
|
||||
// if (pageInfo != null && pageInfo.IsPaging)
|
||||
// list.Skip(pageInfo.PageIndex * pageInfo.PageSize).Limit(pageInfo.PageSize);
|
||||
|
||||
//执行查询
|
||||
return (list.ToList(), count);
|
||||
}
|
||||
// //执行查询
|
||||
// return (list.ToList(), count);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user