Commit d7cb5ece authored by 黄奎's avatar 黄奎

页面修改

parent d4d6c3bf
......@@ -38,6 +38,13 @@ namespace EduSpider.IRepository
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public bool DeleteStuCommentRepository(string Ids)
public bool DeleteStuCommentRepository(string Ids);
/// <summary>
/// 获取系统生成评论次数
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesListRepository(CourseQuery query);
}
}
......@@ -108,5 +108,12 @@ namespace EduSpider.IServices
/// <param name="Ids"></param>
/// <returns></returns>
public bool RemoveStuComment(string Ids);
/// <summary>
/// 获取系统生成评论次数
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesList(CourseQuery query);
}
}
......@@ -44,5 +44,10 @@
/// 作业编号
/// </summary>
public int HomeWorkId { get; set; }
/// <summary>
/// 创建类型(1-系统创建,2-老师创建)
/// </summary>
public int CreateCommentType { get; set; }
}
}
......@@ -95,5 +95,44 @@ WHERE 1=1
string sql = string.Format("UPDATE RB_Stu_Comment SET Status=1 WHERE Id IN({0}) ", Ids);
return base.Execute(sql) > 0;
}
/// <summary>
/// 获取系统生成评论次数
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesListRepository(CourseQuery query)
{
StringBuilder builder = new();
builder.AppendFormat(@"
SELECT A.Times,A.CourseId,MAX(CreateTime) AS CreateTime,CreateType
FROM RB_Stu_Comment AS A
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.CreateCommentType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Stu_Comment.CreateType), query.CreateCommentType);
}
}
builder.AppendFormat(@" GROUP BY A.Times,A.CourseId ");
return Get<RB_Stu_Comment>(builder.ToString()).ToList();
}
}
}
......@@ -377,6 +377,17 @@ namespace EduSpider.Services
{
return StuCommentRepository.DeleteStuCommentRepository(Ids);
}
/// <summary>
/// 获取系统生成评论次数
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Stu_Comment> GetCourseCommentTimesList(CourseQuery query)
{
return StuCommentRepository.GetCourseCommentTimesListRepository(query);
}
}
}
\ No newline at end of file
......@@ -272,6 +272,24 @@ namespace EduSpider.WebApi.Controllers
}
[HttpPost]
[HttpGet]
/// <summary>
/// 获取课程已经生成的评论统计列表
/// </summary>
/// <returns></returns>
public ApiResult GetCourseCommentTimes()
{
var query = new CourseQuery()
{
CourseId = base.ReqParameters.GetInt("CourseId"),
CreateCommentType=1
};
var list = CourseService.GetCourseCommentTimesList(query);
return ApiResult.Success(data: list);
}
[HttpPost]
[HttpGet]
/// <summary>
......@@ -282,7 +300,7 @@ namespace EduSpider.WebApi.Controllers
{
var query = new CourseQuery()
{
CourseId=base.ReqParameters.GetInt("CourseId")
};
var list = CourseService.GetStuCommentList(query);
return ApiResult.Success(data: list);
......
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