mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:03:25 +08:00
【修复】修复商品下架或者删除后,【我的足迹】统计数据及列表不准确的问题。
【修复】修复商品下架或者删除后,【我的收藏】统计数据及列表不准确的问题。
This commit is contained in:
@@ -32,6 +32,23 @@ namespace CoreCms.Net.Repository
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户序列获取用户的足迹数量
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<int> GetUserCountAsync(int userId)
|
||||
{
|
||||
var count = await DbClient.Queryable<CoreCmsGoodsCollection, CoreCmsGoods>((gc, goods) =>
|
||||
new JoinQueryInfos(JoinType.Left, gc.goodsId == goods.id))
|
||||
.Where((gc, goods) => goods.isDel == false && goods.isMarketable == true && gc.userId == userId).With(SqlWith.NoLock).CountAsync();
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
@@ -47,7 +64,19 @@ namespace CoreCms.Net.Repository
|
||||
int pageSize = 20)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
var page = await DbClient.Queryable<CoreCmsGoodsCollection>()
|
||||
var page = await DbClient.Queryable<CoreCmsGoodsCollection, CoreCmsGoods>((gc, goods) =>
|
||||
new JoinQueryInfos(JoinType.Left, gc.goodsId == goods.id))
|
||||
.Where((gc, goods) => goods.isDel == false && goods.isMarketable == true)
|
||||
.Select((gc, goods) => new CoreCmsGoodsCollection
|
||||
{
|
||||
id = gc.id,
|
||||
userId = gc.userId,
|
||||
goodsId = gc.goodsId,
|
||||
createTime = gc.createTime,
|
||||
goodsName = gc.goodsName
|
||||
})
|
||||
.With(SqlWith.NoLock)
|
||||
.MergeTable()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate)
|
||||
.Mapper(p => p.goods, p => p.goodsId)
|
||||
|
||||
Reference in New Issue
Block a user