Commit 8ec90002 authored by 黄奎's avatar 黄奎

新增实体类

parent 10a039dc
......@@ -28,5 +28,10 @@ namespace Edu.Model.ViewModel.Course
/// 更新时间
/// </summary>
public string UpdateTimeStr { get { return this.UpdateTime.FormatTime(); } }
/// <summary>
/// 分类名称
/// </summary>
public string CateName { get; set; }
}
}
\ No newline at end of file
......@@ -124,7 +124,7 @@ namespace Edu.Module.Course
/// <param name="CourseId"></param>
/// <param name="IsShowChapterNo">是否显示章节编号(1-显示,0-不显示)</param>
/// <returns></returns>
public bool SetCourseIsShowChapterNo(int CourseId, int IsShowChapterNo)
public bool SetCourseIsShowChapterNoModule(int CourseId, int IsShowChapterNo)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
......@@ -138,7 +138,7 @@ namespace Edu.Module.Course
/// 设置课程教师
/// </summary>
/// <param name="CourseId"></param>
/// <param name="Teacher_Id"></param>
/// <param name="Teacher_Id">教师编号</param>
/// <returns></returns>
public bool SetCourseTeacherModule(int CourseId, int Teacher_Id)
{
......
using Edu.Model.ViewModel.Course;
using Edu.Common.Enum;
using Edu.Model.ViewModel.Course;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -21,22 +22,23 @@ namespace Edu.Repository.Course
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Course
SELECT A.*,IFNULL(B.CateName,'') AS CateName
FROM RB_Course AS A LEFT JOIN rb_course_category AS B ON A.CateId=B.CateId
WHERE 1=1
");
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND {0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
builder.AppendFormat(" AND A.{0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (query.CateId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
}
}
return Get<RB_Course_ViewModel>(builder.ToString(), parameters).ToList();
......@@ -55,22 +57,27 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Course
SELECT A.*,IFNULL(B.CateName,'') AS CateName
FROM RB_Course AS A LEFT JOIN rb_course_category AS B ON A.CateId=B.CateId
WHERE 1=1
");
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
if (query != null)
{
if ((int)query.Status > -1)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Status), query.Status);
}
if (!string.IsNullOrWhiteSpace(query.CourseName))
{
builder.AppendFormat(" AND {0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
builder.AppendFormat(" AND A.{0} LIKE @CourseName ", nameof(RB_Course_ViewModel.CourseName));
parameters.Add("CourseName", "%" + query.CourseName.Trim() + "%");
}
if (query.CateId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.CateId), query.CateId);
}
}
return GetPage<RB_Course_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
......
......@@ -212,6 +212,35 @@ namespace Edu.WebApi.Controllers.Course
var flag = courseModule.RemoveCourseModule(CourseId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 是否显示章节编号
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCourseIsShowChapterNo()
{
var CourseId = base.ParmJObj.GetInt("CourseId", 0);
int IsShowChapterNo = base.ParmJObj.GetInt("IsShowChapterNo", 0);
var flag = courseModule.SetCourseIsShowChapterNoModule(CourseId, IsShowChapterNo);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 设置课程教师
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCourseTeacher()
{
var CourseId = base.ParmJObj.GetInt("CourseId", 0);
int Teacher_Id = base.ParmJObj.GetInt("Teacher_Id", 0);
var flag = courseModule.SetCourseTeacherModule(CourseId, Teacher_Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 教案管理
#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