Commit 3d02f82b authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 25db8ee7 23dbc4bf
......@@ -420,6 +420,17 @@ namespace Edu.Module.Course
/// <returns></returns>
private List<RB_Class_Plan_ViewModel> CreateClassPlanList(RB_Class_ViewModel model, List<RB_Class_Time_ViewModel> defaultPlanTimeList)
{
var planList = class_PlanRepository.GetClassPlanListRepository(new RB_Class_Plan_ViewModel() { ClassId = model.ClassId, StartTime = DateTime.Now.ToString("yyyy-MM-dd") });
if (planList != null && planList.Count > 0)
{
string ids = string.Join(",", planList.Select(qitem => qitem.ClassPlanId));
if (!string.IsNullOrEmpty(ids))
{
var flag1= class_TimeRepository.DeleteClassTimeByPlanIdsRepository(ids);
var flag2= class_PlanRepository.DeleteClassPlanRepository(ids);
}
}
List<RB_Class_Plan_ViewModel> classPlanList = new List<RB_Class_Plan_ViewModel>();
double totalMinutes = 0;
foreach (var item in defaultPlanTimeList)
......@@ -824,7 +835,7 @@ namespace Edu.Module.Course
//现在没有设置时间【直接删除以前的时间】
if (extModel.PlanTimeList == null || (extModel.PlanTimeList != null && extModel.PlanTimeList.Count == 0))
{
class_TimeRepository.DeleteClassTimeByPlanIdRepository(extModel.ClassPlanId);
class_TimeRepository.DeleteClassTimeByPlanIdsRepository(extModel.ClassPlanId.ToString());
}
//找出差异的数据
var deleteList = oldPlanList.Where(qitem => !extModel.PlanTimeList.Any(oldItem => qitem.ClassTimeId == oldItem.ClassTimeId)).ToList();
......
......@@ -55,6 +55,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m')= DATE_FORMAT('{1}-01','%y/%m') ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.QMonth);
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.AppendFormat(" AND DATE_FORMAT(A.{0},'%y/%m')>='{1}' ", nameof(RB_Class_Plan_ViewModel.ClassDate), query.StartTime);
}
}
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
......@@ -92,13 +96,15 @@ WHERE ClassId={1} AND ClassDate>'{2}'
}
/// <summary>
/// 根据班级编号删除班级上课计划
/// 根据编号删除班级上课计划
/// </summary>
/// <param name="ClassId"></param>
/// <param name="ClassPlanIds"></param>
/// <returns></returns>
public bool DeleteClassPlanRepository(int ClassId)
public bool DeleteClassPlanRepository(string ClassPlanIds)
{
return base.DeleteOne(new VT.FW.DB.WhereHelper(nameof(RB_Class_Plan_ViewModel.ClassId), ClassId));
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" DELETE FROM RB_Class_Plan WHERE ClassPlanId IN({0}) ", ClassPlanIds);
return base.Execute(builder.ToString()) > 0;
}
/// <summary>
......
......@@ -66,26 +66,15 @@ WHERE 1=1
}
/// <summary>
/// 根据计划删除班级上课时间
/// 根据上课计划编号删除上课计划
/// </summary>
/// <param name="ClassPlanId">班级编号</param>
/// <param name="ClassPlanIds"></param>
/// <returns></returns>
public bool DeleteClassTimeByPlanIdRepository(int ClassPlanId)
public bool DeleteClassTimeByPlanIdsRepository(string ClassPlanIds)
{
return base.DeleteOne(new VT.FW.DB.WhereHelper(nameof(RB_Class_Time_ViewModel.ClassPlanId), ClassPlanId));
}
/// <summary>
/// 获取班级上课时间
/// </summary>
/// <param name="classIds"></param>
/// <returns></returns>
public List<RB_Class_Time_ViewModel> GetClassTimeForProduct(string classIds) {
string sql = $@"SELECT t.ClassId,t.StartTime,t.EndTime FROM rb_class_time t
LEFT JOIN rb_class_plan p on t.ClassPlanId = p.ClassPlanId
WHERE p.`Status`=0 AND t.ClassId =1 GROUP BY t.ClassId,t.StartTime,t.EndTime";
return Get<RB_Class_Time_ViewModel>(sql).ToList();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" DELETE FROM RB_Class_Time WHERE ClassPlanId IN({0}) ", ClassPlanIds);
return base.Execute(builder.ToString()) > 0;
}
/// <summary>
......
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