dbcgit 5 лет назад
Родитель
Сommit
213a9dc047
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      backend/src/dashoo.cn/modi_webapi/app/api/course/course.go

+ 5 - 4
backend/src/dashoo.cn/modi_webapi/app/api/course/course.go

@@ -29,19 +29,20 @@ func (c *Controller) GetAllCourse(r *ghttp.Request) {
 
 	if term := r.GetInt("Term"); term != 0 {
 		if where == "" {
-			where = fmt.Sprintf(" Term LIKE '%%%v%%'", term)
+			where = fmt.Sprintf(" Term = %v", term)
 		} else {
-			where += fmt.Sprintf(" AND Term LIKE '%%%v%%'", term)
+			where += fmt.Sprintf(" AND Term = %v", term)
 		}
 	}
 
 	if classId := r.GetInt("ClassId"); classId != 0 {
 		if where == "" {
-			where = fmt.Sprintf(" ClassId LIKE '%%%v%%'", classId)
+			where = fmt.Sprintf(" ClassId = %v", classId)
 		} else {
-			where += fmt.Sprintf(" AND ClassId LIKE '%%%v%%'", classId)
+			where += fmt.Sprintf(" AND ClassId = %v", classId)
 		}
 	}
+
 	var result []course.Entity
 	if err := course.GetAllCourse(page, where, &result); err != nil {
 		if err.Error() == "sql: no rows in result set" {