Commit 59875dfd authored by liudong1993's avatar liudong1993

1

parent 2e99da22
using EduSpider.Model.Entity; using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using EduSpider.Model.Query; using EduSpider.Model.Query;
using System.Collections.Generic; using System.Collections.Generic;
using VTX.FW.Config; using VTX.FW.Config;
...@@ -55,5 +56,12 @@ namespace EduSpider.IRepository ...@@ -55,5 +56,12 @@ namespace EduSpider.IRepository
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesListRepository(CourseQuery query); public List<RB_Stu_Comment> GetCourseCommentTimesListRepository(CourseQuery query);
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment_Extend> GetStuCommentList(CourseQuery query);
} }
} }
...@@ -92,7 +92,7 @@ namespace EduSpider.IServices ...@@ -92,7 +92,7 @@ namespace EduSpider.IServices
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Stu_Comment> GetStuCommentList(CourseQuery query); public List<RB_Stu_Comment_Extend> GetStuCommentList(CourseQuery query);
/// <summary> /// <summary>
/// 修改学员评论状态 /// 修改学员评论状态
......
using EduSpider.Model.Entity;
using System;
using VTX.FW.Attr;
namespace EduSpider.Model.Extend
{
/// <summary>
/// 学生评价扩展
/// </summary>
public class RB_Stu_Comment_Extend : RB_Stu_Comment
{
/// <summary>
/// 学生姓名
/// </summary>
public string StuName { get; set; }
}
}
using EduSpider.IRepository; using EduSpider.IRepository;
using EduSpider.Model.Entity; using EduSpider.Model.Entity;
using EduSpider.Model.Extend;
using EduSpider.Model.Query; using EduSpider.Model.Query;
using EduSpider.Repository.Base; using EduSpider.Repository.Base;
using System; using System;
...@@ -151,5 +152,42 @@ WHERE 1=1 ...@@ -151,5 +152,42 @@ WHERE 1=1
return Get<RB_Stu_Comment>(builder.ToString()).ToList(); return Get<RB_Stu_Comment>(builder.ToString()).ToList();
} }
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment_Extend> GetStuCommentList(CourseQuery query)
{
StringBuilder builder = new();
builder.AppendFormat(@"
SELECT A.*,s.StudentName as StuName
FROM RB_Stu_Comment AS A
left join rb_student s on A.StuUid = s.StudentUid
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}=0 ", nameof(RB_Stu_Comment.Status));
if (query != null)
{
if (query.CourseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stu_Comment.CourseId), query.CourseId);
}
if (!string.IsNullOrWhiteSpace(query.StuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Stu_Comment.StuUid), query.StuIds);
}
if (query.HomeWorkId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stu_Comment.HomeWorkId), query.HomeWorkId);
}
if (query.CommentTimes > 0)
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Stu_Comment.Times), query.CommentTimes);
}
}
return Get<RB_Stu_Comment_Extend>(builder.ToString()).ToList();
}
} }
} }
...@@ -351,9 +351,9 @@ namespace EduSpider.Services ...@@ -351,9 +351,9 @@ namespace EduSpider.Services
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Stu_Comment> GetStuCommentList(CourseQuery query) public List<RB_Stu_Comment_Extend> GetStuCommentList(CourseQuery query)
{ {
var list = StuCommentRepository.GetStuCommentListRepository(query); var list = StuCommentRepository.GetStuCommentList(query);
return list; return list;
} }
......
...@@ -371,8 +371,43 @@ namespace EduSpider.WebApi.Controllers ...@@ -371,8 +371,43 @@ namespace EduSpider.WebApi.Controllers
CourseId = base.ReqParameters.GetInt("CourseId"), CourseId = base.ReqParameters.GetInt("CourseId"),
CommentTimes = base.ReqParameters.GetInt("CommentTimes") CommentTimes = base.ReqParameters.GetInt("CommentTimes")
}; };
List<object> result = new();
var list = CourseService.GetStuCommentList(query); var list = CourseService.GetStuCommentList(query);
return ApiResult.Success(data: list); if (list.Any())
{
foreach (var item in list)
{
string ShowTypeStr = "";
if (item.ShowType == 1)
{
ShowTypeStr = "全部可见";
}
else if (item.ShowType == 2)
{
ShowTypeStr = "部分可见";
}
else if (item.ShowType == 3)
{
ShowTypeStr = "不可见";
}
result.Add(new
{
item.Id,
item.HomeWorkId,
item.StuUid,
item.StuName,
item.CourseId,
item.Times,
item.Info,
item.CreateType,
CreateTypeStr = item.CreateType == 1 ? "系统创建" : "老师创建",
item.ShowType,
ShowTypeStr,
CreateTime = VTX.FW.Helper.ConvertHelper.FormatDate(item.CreateTime)
});
}
}
return ApiResult.Success(data: result);
} }
......
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