Commit 1178c657 authored by 吴春's avatar 吴春

提交代码

parent 64e492b6
......@@ -1420,5 +1420,37 @@ namespace Mall.Module.Product
#endregion
#region 评论总数
/// <summary>
/// 获取商品评论统计
/// </summary>
/// <param name="goodsId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public ApiResult GetAppletGoodsCommentStatistics(int goodsId, int storeId, int servicepersonalId, int tenantId, int mallBaseId)
{
var list = EnumHelper.GetEnumList(typeof(GoodsCommentTypeEnum));
var clist = goods_CommentRepository.GetReserveGoodsCommentStatistics(goodsId, storeId, servicepersonalId, tenantId, mallBaseId);
List<object> RList = new List<object>();
foreach (var item in list)
{
var cmodel = clist.Where(x => (int)x.CommentGrade == Convert.ToInt32(item.Value)).FirstOrDefault();
RList.Add(new
{
Id = Convert.ToInt32(item.Value),
Name = item.Key,
Count = cmodel?.CommentNum ?? 0
});
}
return ApiResult.Success("", new
{
TotalNum = clist.Sum(x => x.CommentNum),
List = RList
});
}
#endregion
}
}
\ No newline at end of file
......@@ -24,7 +24,11 @@ namespace Mall.Repository.Education
public List<RB_Education_Teacher_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Education_Teacher_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Education_Teacher_Extend.Status)}=0");
builder.Append($" SELECT * FROM {TableName} WHERE {nameof(RB_Education_Teacher_Extend.Status)}=0");
// builder.Append(@$" SELECT a.*,c.OrderNum FROM {TableName} as A LEFT JOIN (SELECT od.ServicepersonalId,COUNT(*) OrderNum FROM rb_goods_orderdetail od
//INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
//where o.OrderClassify=2 and o.OrderStatus in(2,3,4,5,6)
//GROUP BY od.ServicepersonalId) as c on a.id=c.ServicepersonalId WHERE a.{nameof(RB_Education_Teacher_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
......
......@@ -145,6 +145,43 @@ where {where} order by c.Id desc";
}
/// <summary>
/// 获取评论数量统计
/// </summary>
/// <param name="goodsId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetReserveGoodsCommentStatistics(int goodsId, int storeId, int servicepersonalId, int tenantId, int mallBaseId)
{
string where = $" 1=1 and c.{nameof(RB_Goods_Comment.Status)}=0 and c.{nameof(RB_Goods_Comment.Is_Show)}=1";
if (tenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={tenantId}";
}
if (mallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={mallBaseId}";
}
if (goodsId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={goodsId}";
}
if (storeId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.StoreId)}={storeId}";
}
if (servicepersonalId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.ServicePersonalId)}={servicepersonalId}";
}
string sql = $@"SELECT c.CommentGrade,COUNT(0) as CommentNum FROM RB_Goods_Comment c where {where} GROUP BY c.CommentGrade";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
/// <summary>
/// 获取车辆和导游评分信息
/// </summary>
......
......@@ -29,7 +29,10 @@ namespace Mall.Repository.Reserve
public List<RB_Reserve_ServicePersonal_Extend> GetServicePersonalPageList(int pageIndex, int pageSize, out long rowCount, RB_Reserve_ServicePersonal_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.`Name` as StoreName FROM {TableName} as A LEFT JOIN rb_stores as b on a.StoreId=b.Id WHERE a.{nameof(RB_Reserve_ServicePersonal_Extend.Status)}=0");
builder.Append(@$" SELECT a.*,b.`Name` as StoreName,c.OrderNum FROM {TableName} as A LEFT JOIN rb_stores as b on a.StoreId=b.Id LEFT JOIN (SELECT od.ServicepersonalId,COUNT(*) OrderNum FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where o.OrderClassify=3 and o.OrderStatus in(2,3,4,5,6)
GROUP BY od.ServicepersonalId) as c on a.id=c.ServicepersonalId WHERE a.{nameof(RB_Reserve_ServicePersonal_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
......
......@@ -982,6 +982,24 @@ namespace Mall.WebApi.Controllers.Reserve
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取商品评论统计
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsCommentStatistics()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject parms = JObject.Parse(req.msg.ToString());
int GoodsId = parms.GetInt("GoodsId", 0);
int StoreId = parms.GetInt("StoreId", 0);
int ServicepersonalId = parms.GetInt("ServicepersonalId", 0);
return offlineGoodsModule.GetAppletGoodsCommentStatistics(GoodsId, StoreId, ServicepersonalId, userInfo.TenantId, userInfo.MallBaseId);
}
#endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment