Commit d66b7cfd authored by 吴春's avatar 吴春

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

parents c6d00769 7a4404c1
......@@ -117,6 +117,15 @@ namespace Edu.Module.Course
return classRepository.GetClassListRepository(query);
}
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetClassListForProperty(RB_Class_ViewModel query)
{
return classRepository.GetClassListForProperty(query);
}
/// <summary>
/// 获取班级课程名称以及老师信息列表
......
......@@ -123,6 +123,47 @@ WHERE 1=1
return Get<RB_Class_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetClassListForProperty(RB_Class_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.CourseName
FROM rb_class AS A
left join rb_course AS B ON A.CouseId=B.CourseId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Status), (int)DateStateEnum.Normal);
builder.AppendFormat(" AND A.{0} in(1,2,3) ", nameof(RB_Class_ViewModel.ClassStatus));// 未开班 + 学习中的
if (query != null)
{
if (query.CouseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.CouseId), query.CouseId);
}
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Group_Id), query.Group_Id);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.ClassId), query.ClassId);
}
if (!string.IsNullOrEmpty(query.Q_ClassIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_ViewModel.ClassId), query.Q_ClassIds);
}
if (query.ClassStatus > 0) {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.ClassStatus), (int)query.ClassStatus);
}
}
return Get<RB_Class_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取班级分页列表
......
......@@ -82,6 +82,31 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取班级列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetClassListForProperty() {
var query = new RB_Class_ViewModel()
{
CouseId = base.ParmJObj.GetInt("CourseId"),
School_Id = base.ParmJObj.GetInt("School_Id", -1)
};
query.Group_Id = base.UserInfo.Group_Id;
var list = classModule.GetClassListForProperty(query);
if (list == null)
{
list = new List<RB_Class_ViewModel>();
}
return ApiResult.Success(data: list.Select(qitem => new
{
qitem.ClassId,
qitem.ClassName,
qitem.CourseName
}));
}
/// <summary>
/// 获取班级列表
/// </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