Commit 19c42320 authored by 罗超's avatar 罗超

更新备课相关

parent 68870cf3
...@@ -78,7 +78,7 @@ namespace Edu.Model.ViewModel.Course ...@@ -78,7 +78,7 @@ namespace Edu.Model.ViewModel.Course
/// </summary> /// </summary>
public List<RB_Class_LessonPlan_ViewModel> LessonPlanList { get; set; } public List<RB_Class_LessonPlan_ViewModel> LessonPlanList { get; set; }
public RB_Course_Chapter_ViewModel Chapter { get; set; } public List<ChapterTree_ViewModel> Chapter { get; set; }
public string CourseName { get; set; } public string CourseName { get; set; }
......
...@@ -568,9 +568,15 @@ namespace Edu.Module.Course ...@@ -568,9 +568,15 @@ namespace Edu.Module.Course
return treeList; return treeList;
} }
public RB_Course_Chapter_ViewModel GetMatchHoursChapterModule(int courseId,double currentHours) public List<ChapterTree_ViewModel> GetMatchHoursChapterModule(int courseId,double currentHours)
{ {
return chapterRepository.GetMatchHoursChapterRepository(courseId,currentHours); var list = chapterRepository.GetMatchHoursChapterRepository(courseId, currentHours);
list.ForEach(x =>
{
x.SerialNumber = int.Parse(x.ChapterNo.Replace(".", ""));
});
List<ChapterTree_ViewModel> treeList = GetChapterChild(list, 0);
return treeList;
} }
/// <summary> /// <summary>
......
...@@ -568,14 +568,15 @@ GROUP BY A.ClassPlanId,A.ClassId ,A.ClassDate,A.ClassRoomId,A.CompleteProgress ...@@ -568,14 +568,15 @@ GROUP BY A.ClassPlanId,A.ClassId ,A.ClassDate,A.ClassRoomId,A.CompleteProgress
/// <returns></returns> /// <returns></returns>
public double GetCurrentPlanStudyHoursRepository(int planId) public double GetCurrentPlanStudyHoursRepository(int planId)
{ {
string sql = @"select // string sql = @"select
(select SUM(timestampdiff(MINUTE, Concat(SUBSTRING_INDEX(d.ClassDate, ' ', 1), ' ', c.StartTime), Concat(SUBSTRING_INDEX(d.ClassDate, ' ', 1), ' ', c.EndTime))) / 45 // (select SUM(timestampdiff(MINUTE, Concat(SUBSTRING_INDEX(d.ClassDate, ' ', 1), ' ', c.StartTime), Concat(SUBSTRING_INDEX(d.ClassDate, ' ', 1), ' ', c.EndTime))) / 45
from rb_class_time c left // from rb_class_time c left
join rb_class_plan d on c.ClassPlanId = d.ClassPlanId // join rb_class_plan d on c.ClassPlanId = d.ClassPlanId
where d.ClassDate < b.ClassDate and c.ClassId = b.ClassId) // where d.ClassDate < b.ClassDate and c.ClassId = b.ClassId)
from rb_class_plan b where b.ClassPlanId = " + planId + " and b.`Status`= 0"; //from rb_class_plan b where b.ClassPlanId = " + planId + " and b.`Status`= 0";
string sql = "select (select Count(0) from rb_class_plan b where b.ClassId=a.ClassId and b.ClassDate<a.ClassDate) from rb_class_plan a where ClassPlanId="+planId+" and `Status`=0";
object obj = ExecuteScalar(sql); object obj = ExecuteScalar(sql);
return Convert.IsDBNull(obj) ? -1 : Convert.ToDouble(obj); return Convert.IsDBNull(obj) ? -1 : Convert.ToDouble(obj);
} }
......
...@@ -117,7 +117,7 @@ namespace Edu.Repository.Course ...@@ -117,7 +117,7 @@ namespace Edu.Repository.Course
/// <param name="courseId"></param> /// <param name="courseId"></param>
/// <param name="currentHours"></param> /// <param name="currentHours"></param>
/// <returns></returns> /// <returns></returns>
public RB_Course_Chapter_ViewModel GetMatchHoursChapterRepository(int courseId, double currentHours) public List<RB_Course_Chapter_ViewModel> GetMatchHoursChapterRepository(int courseId, double currentHours)
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
...@@ -128,9 +128,9 @@ namespace Edu.Repository.Course ...@@ -128,9 +128,9 @@ namespace Edu.Repository.Course
"); ");
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal)); builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId); builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.CourseId), courseId);
builder.AppendFormat(" AND {0}<={1}", nameof(RB_Course_Chapter_ViewModel.CurrentHours), currentHours); builder.AppendFormat(" AND ({0}='{1}' or {2} like '{3}.%')", nameof(RB_Course_Chapter_ViewModel.ChapterNo), currentHours, nameof(RB_Course_Chapter_ViewModel.ChapterNo), currentHours);
builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours)); //builder.AppendFormat(" ORDER BY {0} Desc",nameof(RB_Course_Chapter_ViewModel.CurrentHours));
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList().FirstOrDefault(); return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
} }
} }
} }
...@@ -1441,7 +1441,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1441,7 +1441,7 @@ namespace Edu.WebApi.Controllers.Course
#region 追加章节信息 #region 追加章节信息
var hours = classModule.GetCurrentPlanStudyHoursRepository(model.ClassPlanId); var hours = classModule.GetCurrentPlanStudyHoursRepository(model.ClassPlanId)+1;
if (hours != -1) if (hours != -1)
{ {
var classObj = classModule.GetClassModule(model.ClassId); var classObj = classModule.GetClassModule(model.ClassId);
...@@ -1449,11 +1449,11 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1449,11 +1449,11 @@ namespace Edu.WebApi.Controllers.Course
var courseOjb = new CourseModule().GetCourseModule(classObj.CouseId); var courseOjb = new CourseModule().GetCourseModule(classObj.CouseId);
var chapter = new CourseModule().GetMatchHoursChapterModule(classObj.CouseId, hours); var chapter = new CourseModule().GetMatchHoursChapterModule(classObj.CouseId, hours);
if (chapter != null && chapter.ChapterId > 0) if (chapter != null && chapter.Count > 0)
{ {
chapter.CourseName = courseOjb.CourseName;
model.Chapter = chapter; model.Chapter = chapter;
} }
model.CourseName = courseOjb.CourseName;
} }
#endregion #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