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

页面修改

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