Commit 48207e87 authored by 黄奎's avatar 黄奎

页面修改

parent 9502602c
......@@ -50,4 +50,18 @@ namespace Edu.Model.ViewModel.Course
public int IsQRoot { get; set; }
}
[Serializable]
public class ChapterCurrentHoursItem
{
/// <summary>
/// 章节编号
/// </summary>
public int ChapterId { get; set; }
/// <summary>
/// 累计课时
/// </summary>
public double CurrentHours { get; set; }
}
}
......@@ -790,13 +790,13 @@ namespace Edu.Module.Course
CourseId = courseId
};
var result = GetChapterTreeListModule(query);
List<RB_Course_Chapter_ViewModel> list = new List<RB_Course_Chapter_ViewModel>();
List<ChapterCurrentHoursItem> list = new List<ChapterCurrentHoursItem>();
var currentHours = 0.00;
result.ForEach(x =>
{
if (x.ChildList != null && x.ChildList.Count > 0)
{
list.Add(new RB_Course_Chapter_ViewModel()
list.Add(new ChapterCurrentHoursItem()
{
ChapterId = x.ChapterId,
CurrentHours = -1.00
......@@ -805,7 +805,7 @@ namespace Edu.Module.Course
{
if (y.StudyHours > 0)
{
list.Add(new RB_Course_Chapter_ViewModel()
list.Add(new ChapterCurrentHoursItem()
{
ChapterId = y.ChapterId,
CurrentHours = currentHours
......@@ -814,7 +814,7 @@ namespace Edu.Module.Course
}
else
{
list.Add(new RB_Course_Chapter_ViewModel()
list.Add(new ChapterCurrentHoursItem()
{
ChapterId = y.ChapterId,
CurrentHours = -1.00
......@@ -826,7 +826,7 @@ namespace Edu.Module.Course
{
if (x.StudyHours > 0)
{
list.Add(new RB_Course_Chapter_ViewModel()
list.Add(new ChapterCurrentHoursItem()
{
ChapterId = x.ChapterId,
CurrentHours = currentHours
......@@ -835,7 +835,7 @@ namespace Edu.Module.Course
}
else
{
list.Add(new RB_Course_Chapter_ViewModel()
list.Add(new ChapterCurrentHoursItem()
{
ChapterId = x.ChapterId,
CurrentHours = -1
......
......@@ -130,27 +130,26 @@ namespace Edu.Repository.Course
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public bool SetBatchCurrentHoursRepository(List<RB_Course_Chapter_ViewModel> param)
public bool SetBatchCurrentHoursRepository(List<ChapterCurrentHoursItem> param)
{
bool flag = false;
try
{
StringBuilder builder = new StringBuilder();
builder.Append("INSERT INTO rb_course_chapter (ChapterId, CurrentHours) VALUES");
param.ForEach(x =>
{
builder.Append($"({x.ChapterId},'{x.CurrentHours}'),");
});
builder = builder.Remove(builder.Length - 1, 1);
builder.Append("ON DUPLICATE KEY UPDATE CurrentHours=VALUES(CurrentHours);");
flag = Execute(builder.ToString()) > 0;
//builder.Append(@" REPLACE INTO rb_course_chapter (ChapterId, CurrentHours) VALUES(@ChapterId,@CurrentHours)");
//param
//builder.Append("INSERT INTO rb_course_chapter (ChapterId, CurrentHours) VALUES");
//param.ForEach(x =>
//{
// builder.Append($"({x.ChapterId},'{x.CurrentHours}'),");
//});
//builder = builder.Remove(builder.Length - 1, 1);
//builder.Append("ON DUPLICATE KEY UPDATE CurrentHours=VALUES(CurrentHours);");
//flag = Execute(builder.ToString()) > 0;
builder.Append(@" REPLACE INTO rb_course_chapter(ChapterId, CurrentHours) VALUES(@ChapterId,@CurrentHours)");
flag = Execute(builder.ToString(), param) > 0;
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetBatchCurrentHoursRepository");
Common.Plugin.LogHelper.Write(ex, "SetBatchCurrentHoursRepository::param" + Common.Plugin.JsonHelper.Serialize(param));
}
return flag;
}
......
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