mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:03:27 +08:00
添加项目文件。
This commit is contained in:
95
CoreCms.Net.Repository/User/CoreCmsUserBalanceRepository.cs
Normal file
95
CoreCms.Net.Repository/User/CoreCmsUserBalanceRepository.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户余额表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserBalanceRepository : BaseRepository<CoreCmsUserBalance>, ICoreCmsUserBalanceRepository
|
||||
{
|
||||
public CoreCmsUserBalanceRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserBalance>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsUserBalance, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserBalance, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsUserBalance> page;
|
||||
if (blUseNoLock)
|
||||
page = await DbClient.Queryable<CoreCmsUserBalance, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsUserBalance
|
||||
{
|
||||
id = p.id,
|
||||
userId = p.userId,
|
||||
type = p.type,
|
||||
money = p.money,
|
||||
balance = p.balance,
|
||||
sourceId = p.sourceId,
|
||||
memo = p.memo,
|
||||
createTime = p.createTime,
|
||||
userNickName = sc.nickName
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
else
|
||||
page = await DbClient.Queryable<CoreCmsUserBalance, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsUserBalance
|
||||
{
|
||||
id = p.id,
|
||||
userId = p.userId,
|
||||
type = p.type,
|
||||
money = p.money,
|
||||
balance = p.balance,
|
||||
sourceId = p.sourceId,
|
||||
memo = p.memo,
|
||||
createTime = p.createTime,
|
||||
userNickName = sc.nickName
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
var list = new PageList<CoreCmsUserBalance>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
26
CoreCms.Net.Repository/User/CoreCmsUserBankCardRepository.cs
Normal file
26
CoreCms.Net.Repository/User/CoreCmsUserBankCardRepository.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 银行卡信息 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserBankCardRepository : BaseRepository<CoreCmsUserBankCard>, ICoreCmsUserBankCardRepository
|
||||
{
|
||||
public CoreCmsUserBankCardRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
27
CoreCms.Net.Repository/User/CoreCmsUserGradeRepository.cs
Normal file
27
CoreCms.Net.Repository/User/CoreCmsUserGradeRepository.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户等级表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserGradeRepository : BaseRepository<CoreCmsUserGrade>, ICoreCmsUserGradeRepository
|
||||
{
|
||||
public CoreCmsUserGradeRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
26
CoreCms.Net.Repository/User/CoreCmsUserLogRepository.cs
Normal file
26
CoreCms.Net.Repository/User/CoreCmsUserLogRepository.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户日志 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserLogRepository : BaseRepository<CoreCmsUserLog>, ICoreCmsUserLogRepository
|
||||
{
|
||||
public CoreCmsUserLogRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
26
CoreCms.Net.Repository/User/CoreCmsUserPointLogRepository.cs
Normal file
26
CoreCms.Net.Repository/User/CoreCmsUserPointLogRepository.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户积分记录表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserPointLogRepository : BaseRepository<CoreCmsUserPointLog>, ICoreCmsUserPointLogRepository
|
||||
{
|
||||
public CoreCmsUserPointLogRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
209
CoreCms.Net.Repository/User/CoreCmsUserRepository.cs
Normal file
209
CoreCms.Net.Repository/User/CoreCmsUserRepository.cs
Normal file
@@ -0,0 +1,209 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserRepository : BaseRepository<CoreCmsUser>, ICoreCmsUserRepository
|
||||
{
|
||||
public CoreCmsUserRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取下级推广用户数量
|
||||
/// </summary>
|
||||
/// <param name="parentId">父类序列</param>
|
||||
/// <param name="type">1获取1级,其他为2级</param>
|
||||
/// <param name="thisMonth">显示当月</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> QueryChildCountAsync(int parentId, int type = 1, bool thisMonth = false)
|
||||
{
|
||||
var totalSum = 0;
|
||||
|
||||
DateTime dt = DateTime.Now;
|
||||
//本月第一天时间
|
||||
DateTime dtFirst = dt.AddDays(1 - (dt.Day));
|
||||
dtFirst = new DateTime(dtFirst.Year, dtFirst.Month, dtFirst.Day, 0, 0, 0);
|
||||
//获得某年某月的天数
|
||||
int year = dt.Date.Year;
|
||||
int month = dt.Date.Month;
|
||||
int dayCount = DateTime.DaysInMonth(year, month);
|
||||
//本月最后一天时间
|
||||
DateTime dtLast = dtFirst.AddDays(dayCount - 1);
|
||||
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
totalSum = await DbClient.Queryable<CoreCmsUser>().Where(p => p.parentId == parentId)
|
||||
.WhereIF(thisMonth, p => p.createTime > dtFirst && p.createTime < dtLast).With(SqlWith.NoLock)
|
||||
.CountAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
totalSum = await DbClient.Queryable<CoreCmsUser, CoreCmsUser>(
|
||||
(p, sParentUser) => new object[]
|
||||
{
|
||||
JoinType.Left,p.parentId==sParentUser.id
|
||||
}
|
||||
)
|
||||
.Select((p, sParentUser) => new CoreCmsUser()
|
||||
{
|
||||
id = p.id,
|
||||
parentId = p.parentId,
|
||||
childNum = SqlFunc.Subqueryable<CoreCmsUser>().Where(o => o.parentId == p.id).WhereIF(thisMonth, o => o.createTime > dtFirst && o.createTime < dtLast).Count()
|
||||
})
|
||||
.MergeTable().With(SqlWith.Null)
|
||||
.Where(p => p.parentId == parentId)
|
||||
.SumAsync(p => p.childNum);
|
||||
}
|
||||
|
||||
return totalSum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<CoreCmsUser>> QueryPageAsync(Expression<Func<CoreCmsUser, bool>> predicate,
|
||||
Expression<Func<CoreCmsUser, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
var page = await DbClient.Queryable<CoreCmsUser, CoreCmsUserWeChatInfo, CoreCmsUser>(
|
||||
(p, sWeChatInfo, sParentUser) => new object[]
|
||||
{
|
||||
JoinType.Left,p.id==sWeChatInfo.userId,
|
||||
JoinType.Left,p.parentId==sParentUser.id
|
||||
}
|
||||
)
|
||||
.Select((p, sWeChatInfo, sParentUser) => new CoreCmsUser()
|
||||
{
|
||||
id = p.id,
|
||||
userName = p.userName,
|
||||
passWord = p.passWord,
|
||||
mobile = p.mobile,
|
||||
sex = p.sex,
|
||||
birthday = p.birthday,
|
||||
avatarImage = p.avatarImage,
|
||||
nickName = p.nickName,
|
||||
balance = p.balance,
|
||||
point = p.point,
|
||||
grade = p.grade,
|
||||
createTime = p.createTime,
|
||||
updataTime = p.updataTime,
|
||||
status = p.status,
|
||||
parentId = p.parentId,
|
||||
userWx = p.userWx,
|
||||
isDelete = p.isDelete,
|
||||
type = (int)sWeChatInfo.type,
|
||||
parentNickName = sParentUser.nickName,
|
||||
childNum = SqlFunc.Subqueryable<CoreCmsUser>().Where(o => o.parentId == p.id).Count()
|
||||
})
|
||||
.MergeTable().With(SqlWith.Null)
|
||||
.OrderBy(orderByExpression, orderByType)
|
||||
.Where(predicate)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
var list = new PageList<CoreCmsUser>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按天统计新会员
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<StatisticsOut>> Statistics(int day)
|
||||
{
|
||||
var dt = DateTime.Now.AddDays(-day);
|
||||
var list = await DbClient.Queryable<CoreCmsUser>()
|
||||
.Where(p => p.createTime >= dt)
|
||||
.Select(it => new
|
||||
{
|
||||
it.id,
|
||||
createTime = it.createTime.Date
|
||||
})
|
||||
.MergeTable()
|
||||
.GroupBy(it => it.createTime)
|
||||
.Select(it => new StatisticsOut { day = it.createTime.ToString("yyyy-MM-dd"), nums = SqlFunc.AggregateCount(it.id) })
|
||||
.ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按天统计当天下单活跃会员
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<StatisticsOut>> StatisticsOrder(int day)
|
||||
{
|
||||
|
||||
var outs = new List<StatisticsOut>();
|
||||
|
||||
for (int i = 0; i < day; i++)
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
var where = PredicateBuilder.True<CoreCmsOrder>();
|
||||
var currDay = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
if (i == 0)
|
||||
{
|
||||
where = where.And(p => p.createTime < DateTime.Now);
|
||||
currDay = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
}
|
||||
else
|
||||
{
|
||||
var iDt = DateTime.Now.AddDays(-i);
|
||||
var dtEnd = new DateTime(iDt.Year, iDt.Month, iDt.Day, 23, 59, 59);
|
||||
where = where.And(p => p.createTime < dtEnd);
|
||||
currDay = DateTime.Now.AddDays(-i).ToString("yyyy-MM-dd");
|
||||
}
|
||||
var iDt2 = DateTime.Now.AddDays(-i);
|
||||
var dtStart = new DateTime(iDt2.Year, iDt2.Month, iDt2.Day, 00, 00, 00);
|
||||
where = where.And(p => p.createTime >= dtStart);
|
||||
|
||||
var item = new StatisticsOut();
|
||||
item.nums = await DbClient.Queryable<CoreCmsOrder>().Where(where).GroupBy(p => p.userId).Select(p => p.userId).CountAsync();
|
||||
item.day = currDay;
|
||||
outs.Add(item);
|
||||
}
|
||||
|
||||
return outs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
100
CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs
Normal file
100
CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户地址表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserShipRepository : BaseRepository<CoreCmsUserShip>, ICoreCmsUserShipRepository
|
||||
{
|
||||
public CoreCmsUserShipRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#region 重写异步插入方法
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<WebApiCallBack> InsertAsync(CoreCmsUserShip entity)
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
if (entity.isDefault == true)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsUserShip>().SetColumns(p => p.isDefault == false).Where(p => p.userId == entity.userId).ExecuteCommandAsync();
|
||||
}
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写异步更新方法方法
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsUserShip entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsUserShip>().Where(p => p.id == entity.id && p.userId == entity.userId).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.areaId = entity.areaId;
|
||||
oldModel.address = entity.address;
|
||||
oldModel.name = entity.name;
|
||||
oldModel.mobile = entity.mobile;
|
||||
oldModel.isDefault = entity.isDefault;
|
||||
//oldModel.createTime = entity.createTime;
|
||||
oldModel.updateTime = entity.updateTime;
|
||||
|
||||
if (oldModel.isDefault)
|
||||
{
|
||||
await DbClient.Updateable<CoreCmsUserShip>().SetColumns(p => p.isDefault == false).Where(p => p.userId == entity.userId).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
108
CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs
Normal file
108
CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户提现记录表 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsUserTocashRepository : BaseRepository<CoreCmsUserTocash>, ICoreCmsUserTocashRepository
|
||||
{
|
||||
public CoreCmsUserTocashRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<CoreCmsUserTocash>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsUserTocash, bool>> predicate,
|
||||
Expression<Func<CoreCmsUserTocash, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsUserTocash> page;
|
||||
if (blUseNoLock)
|
||||
page = await DbClient.Queryable<CoreCmsUserTocash, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsUserTocash
|
||||
{
|
||||
id = p.id,
|
||||
userId = p.userId,
|
||||
money = p.money,
|
||||
bankName = p.bankName,
|
||||
bankCode = p.bankCode,
|
||||
bankAreaId = p.bankAreaId,
|
||||
accountBank = p.accountBank,
|
||||
accountName = p.accountName,
|
||||
cardNumber = p.cardNumber,
|
||||
withdrawals = p.withdrawals,
|
||||
status = p.status,
|
||||
createTime = p.createTime,
|
||||
updateTime = p.updateTime,
|
||||
userNickName = sc.nickName
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
else
|
||||
page = await DbClient.Queryable<CoreCmsUserTocash, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsUserTocash
|
||||
{
|
||||
id = p.id,
|
||||
userId = p.userId,
|
||||
money = p.money,
|
||||
bankName = p.bankName,
|
||||
bankCode = p.bankCode,
|
||||
bankAreaId = p.bankAreaId,
|
||||
accountBank = p.accountBank,
|
||||
accountName = p.accountName,
|
||||
cardNumber = p.cardNumber,
|
||||
withdrawals = p.withdrawals,
|
||||
status = p.status,
|
||||
createTime = p.createTime,
|
||||
updateTime = p.updateTime,
|
||||
userNickName = sc.nickName
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
|
||||
|
||||
var list = new PageList<CoreCmsUserTocash>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user