Commit dbe9ec3a authored by 黄奎's avatar 黄奎

新增查询条件

parent 85e2002e
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
/// 课程状态(0-全部,1-进行中,2,-已完成) /// 课程状态(0-全部,1-进行中,2,-已完成)
/// </summary> /// </summary>
public int QCourseState { get; set; } public int QCourseState { get; set; }
/// <summary>
/// 关键词
/// </summary>
public string KeyWords { get; set;}
} }
} }
...@@ -42,7 +42,6 @@ WHERE 1=1 ...@@ -42,7 +42,6 @@ WHERE 1=1
"); ");
if (query != null) if (query != null)
{ {
if (query.CourseId > 0) if (query.CourseId > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Student.courseId), query.CourseId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_Student.courseId), query.CourseId);
...@@ -64,6 +63,11 @@ WHERE 1=1 ...@@ -64,6 +63,11 @@ WHERE 1=1
builder.AppendFormat(" AND B.{0} IN({1}) ", nameof(RB_Course.CourseStatus), 3); builder.AppendFormat(" AND B.{0} IN({1}) ", nameof(RB_Course.CourseStatus), 3);
} }
} }
if (!string.IsNullOrWhiteSpace(query.KeyWords))
{
builder.AppendFormat(" AND B.{0} LIKE @KeyWords ", nameof(RB_Course.CourseName));
parameters.Add("KeyWords", "%" + query.KeyWords.Trim() + "%");
}
} }
builder.AppendFormat(" ORDER BY A.courseId DESC "); builder.AppendFormat(" ORDER BY A.courseId DESC ");
return Get<RB_Course_Teacher_Extend>(builder.ToString(), parameters).ToList(); return Get<RB_Course_Teacher_Extend>(builder.ToString(), parameters).ToList();
......
...@@ -29,7 +29,8 @@ namespace EduSpider.WebApi.Controllers ...@@ -29,7 +29,8 @@ namespace EduSpider.WebApi.Controllers
{ {
var query = new Model.Query.CourseQuery() var query = new Model.Query.CourseQuery()
{ {
TeacherIds = base.BaseUserId.ToString() TeacherIds = base.BaseUserId.ToString(),
KeyWords=base.ReqParameters.GetString("KeyWords"),
}; };
//全部课程 //全部课程
List<object> AllCourseList = new(); List<object> AllCourseList = new();
......
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