mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
添加项目文件。
This commit is contained in:
@@ -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 CoreCmsInvoiceRecordRepository : BaseRepository<CoreCmsInvoiceRecord>, ICoreCmsInvoiceRecordRepository
|
||||
{
|
||||
public CoreCmsInvoiceRecordRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
103
CoreCms.Net.Repository/Financial/CoreCmsInvoiceRepository.cs
Normal file
103
CoreCms.Net.Repository/Financial/CoreCmsInvoiceRepository.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
/***********************************************************************
|
||||
* 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 CoreCmsInvoiceRepository : BaseRepository<CoreCmsInvoice>, ICoreCmsInvoiceRepository
|
||||
{
|
||||
public CoreCmsInvoiceRepository(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<CoreCmsInvoice>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsInvoice, bool>> predicate,
|
||||
Expression<Func<CoreCmsInvoice, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsInvoice> page;
|
||||
if (blUseNoLock)
|
||||
page = await DbClient.Queryable<CoreCmsInvoice, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsInvoice
|
||||
{
|
||||
id = p.id,
|
||||
category = p.category,
|
||||
sourceId = p.sourceId,
|
||||
userId = p.userId,
|
||||
type = p.type,
|
||||
title = p.title,
|
||||
taxNumber = p.taxNumber,
|
||||
amount = p.amount,
|
||||
status = p.status,
|
||||
remarks = p.remarks,
|
||||
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<CoreCmsInvoice, CoreCmsUser>((p, sc) => new JoinQueryInfos(
|
||||
JoinType.Left, p.userId == sc.id))
|
||||
.Select((p, sc) => new CoreCmsInvoice
|
||||
{
|
||||
id = p.id,
|
||||
category = p.category,
|
||||
sourceId = p.sourceId,
|
||||
userId = p.userId,
|
||||
type = p.type,
|
||||
title = p.title,
|
||||
taxNumber = p.taxNumber,
|
||||
amount = p.amount,
|
||||
status = p.status,
|
||||
remarks = p.remarks,
|
||||
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<CoreCmsInvoice>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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 CoreCmsPaymentsRepository : BaseRepository<CoreCmsPayments>, ICoreCmsPaymentsRepository
|
||||
{
|
||||
public CoreCmsPaymentsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
134
CoreCms.Net.Repository/Financial/CoreCmsReportsRepository.cs
Normal file
134
CoreCms.Net.Repository/Financial/CoreCmsReportsRepository.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
/***********************************************************************
|
||||
* 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.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.Echarts;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 报表通用返回 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsReportsRepository : BaseRepository<GetOrdersReportsDbSelectOut>, ICoreCmsReportsRepository
|
||||
{
|
||||
public CoreCmsReportsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取订单销量查询返回结果
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <param name="filterSed"></param>
|
||||
/// <param name="thesort"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<GoodsSalesVolume>> GetGoodsSalesVolumes(string start, string end, string filter, string filterSed, string thesort, int pageIndex = 1, int pageSize = 5000)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
|
||||
var startDt = DateTime.Parse(start);
|
||||
var endDt = DateTime.Parse(end);
|
||||
|
||||
var orderBy = thesort switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
|
||||
var data = await DbClient.Queryable<CoreCmsOrderItem>()
|
||||
.LeftJoin<CoreCmsOrder>((oi, o) => oi.orderId == o.orderId)
|
||||
.Where((oi, o) => o.payStatus != 1 && o.paymentTime > startDt && o.paymentTime <= endDt)
|
||||
.GroupBy((oi, o) => new
|
||||
{
|
||||
oi.sn,
|
||||
oi.name,
|
||||
oi.imageUrl,
|
||||
oi.addon
|
||||
})
|
||||
.Select((oi, o) => new GoodsSalesVolume()
|
||||
{
|
||||
nums = SqlFunc.AggregateSum(oi.nums),
|
||||
amount = SqlFunc.AggregateSum(oi.amount),
|
||||
sn = oi.sn,
|
||||
name = oi.name,
|
||||
imageUrl = oi.imageUrl,
|
||||
addon = oi.addon
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByIF(filter == "nums", p => p.nums, orderBy)
|
||||
.OrderByIF(filter == "amount", p => p.amount, orderBy)
|
||||
.OrderByIF(filterSed == "nums", p => p.nums, orderBy)
|
||||
.OrderByIF(filterSed == "amount", p => p.amount, orderBy)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
|
||||
var list = new PageList<GoodsSalesVolume>(data, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品收藏查询返回结果
|
||||
/// </summary>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <param name="thesort"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<GoodsCollection>> GetGoodsCollections(string start, string end, string thesort, int pageIndex = 1, int pageSize = 5000)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
|
||||
var startDt = DateTime.Parse(start);
|
||||
var endDt = DateTime.Parse(end);
|
||||
|
||||
var orderBy = thesort switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
|
||||
var data = await DbClient.Queryable<CoreCmsGoodsCollection>()
|
||||
.LeftJoin<CoreCmsGoods>((gc, g) => gc.goodsId == g.id)
|
||||
.Where((gc, g) => gc.createTime > startDt && gc.createTime <= endDt)
|
||||
.GroupBy((gc, g) => new { gc.goodsId, gc.goodsName, g.images })
|
||||
.Select((gc, g) => new GoodsCollection()
|
||||
{
|
||||
nums = SqlFunc.AggregateCount(gc.goodsId),
|
||||
goodsName = gc.goodsName,
|
||||
goodId = gc.goodsId,
|
||||
images = g.images
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderBy(gc => gc.nums, orderBy)
|
||||
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
|
||||
var list = new PageList<GoodsCollection>(data, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user