Commit 0878328e authored by 吴春's avatar 吴春

提交代码

parent 2999c017
......@@ -23,14 +23,14 @@ namespace Edu.Model.Entity.System
/// <summary>
/// 节假日开始时间
/// </summary>
public DateTime StartTime { get; set; }
public DateTime? StartTime { get; set; }
/// <summary>
/// 节假日结束时间
/// </summary>
public DateTime EndTime { get; set; }
public DateTime? EndTime { get; set; }
/// <summary>
......
......@@ -34,6 +34,20 @@ namespace Edu.Repository.System
sb.AppendFormat(" AND A.{0}={1} ", nameof(RB_System_Holiday.HolidayId), model.HolidayId);
}
if (model.Group_Id > 0)
{
sb.AppendFormat(" AND A.{0}={1} ", nameof(RB_System_Holiday.Group_Id), model.Group_Id);
}
if (model.StartTime.HasValue)
{
sb.AppendFormat(" AND DATE_FORMAT(A.{0}, '%y/%m/%d') >= DATE_FORMAT('{1}', '%y/%m/%d') ", nameof(RB_System_Holiday.StartTime), model.StartTime.Value.ToString("yyyy-MM-dd"));
}
if (model.EndTime.HasValue)
{
sb.AppendFormat(" AND DATE_FORMAT(A.{0}, '%y/%m/%d') <= DATE_FORMAT('{1}', '%y/%m/%d') ", nameof(RB_System_Holiday.StartTime), model.EndTime.Value.ToString("yyyy-MM-dd"));
}
if (model.Group_Id > 0)
{
sb.AppendFormat(" AND A.{0}={1} ", nameof(RB_System_Holiday.Group_Id), model.Group_Id);
......
......@@ -89,8 +89,8 @@ namespace Edu.WebApi.Controllers.Public
var planList = classModule.GetClassPlanList_V3(new Model.ViewModel.Course.RB_Class_Plan_ViewModel
{
Group_Id = userInfo.Group_Id,
StartTime = dmodel.StartTime.ToString("yyyy-MM-dd 00:00:00"),
EndTime = dmodel.EndTime.ToString("yyyy-MM-dd 00:00:00")
StartTime = dmodel.StartTime.HasValue ? dmodel.StartTime.Value.ToString("yyyy-MM-dd 00:00:00") : "",
EndTime = dmodel.EndTime.HasValue ? dmodel.EndTime.Value.ToString("yyyy-MM-dd 00:00:00") : ""
});
if (planList != null && planList.Any())
......@@ -98,7 +98,7 @@ namespace Edu.WebApi.Controllers.Public
return ApiResult.Success("班级:" + string.Join(",", planList.Select(x => x.ClassName)) + "存在排课");
}
}
return ApiResult.Success();
}
else
......@@ -141,10 +141,27 @@ namespace Edu.WebApi.Controllers.Public
{
UserInfo userInfo = base.UserInfo;
ResultPageModel pmodel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var startDate = base.ParmJObj.GetStringValue("StartTime");
var endDate = base.ParmJObj.GetStringValue("EndTime");
RB_System_Holiday dmodel = new RB_System_Holiday
{
DayType = base.ParmJObj.GetInt("DayType", 0)
};
try
{
if (!string.IsNullOrWhiteSpace(startDate))
{
dmodel.StartTime = Convert.ToDateTime(startDate);
}
if (!string.IsNullOrWhiteSpace(endDate))
{
dmodel.EndTime = Convert.ToDateTime(endDate);
}
}
catch (Exception ex)
{
}
List<RB_System_Holiday> list = holidayModule.GetPageList(pmodel.PageIndex, pmodel.PageSize, dmodel, out long count);
......@@ -152,8 +169,8 @@ namespace Edu.WebApi.Controllers.Public
pmodel.PageData = list.Select(x => new
{
x.HolidayId,
StartTime = x.StartTime.ToString("yyyy-MM-dd"),
EndTime = x.EndTime.ToString("yyyy-MM-dd"),
StartTime = x.StartTime.HasValue ? x.StartTime.Value.ToString("yyyy-MM-dd") : "",
EndTime = x.EndTime.HasValue ? x.EndTime.Value.ToString("yyyy-MM-dd") : "",
x.DayType
});
return ApiResult.Success("", pmodel);
......@@ -178,8 +195,8 @@ namespace Edu.WebApi.Controllers.Public
var obj = new
{
model.HolidayId,
StartTime = model.StartTime.ToString("yyyy-MM-dd"),
EndTime = model.EndTime.ToString("yyyy-MM-dd"),
StartTime = model.StartTime.HasValue ? model.StartTime.Value.ToString("yyyy-MM-dd") : "",
EndTime = model.EndTime.HasValue ? model.EndTime.Value.ToString("yyyy-MM-dd") : "",
model.DayType
};
return ApiResult.Success("请求成功!", obj);
......
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