This commit is contained in:
wucongxing8150 2024-09-19 17:00:58 +08:00
parent 606693a475
commit 1091654b7c

View File

@ -2,6 +2,7 @@ package dao
import (
"errors"
"fmt"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"hepa-calc-api/api/model"
@ -186,6 +187,7 @@ func (r *QuestionDao) GetQuestionPageSearch(req requests.GetQuestionPage, page,
// 搜索关键字
if req.Keyword != "" {
fmt.Println(111)
keyword := "%" + req.Keyword + "%" //
// 标题
@ -204,7 +206,11 @@ func (r *QuestionDao) GetQuestionPageSearch(req requests.GetQuestionPage, page,
Where(gorm.Expr("class_id IN (?)", baseClassSubQuery))
orQuery = orQuery.Or(gorm.Expr("question_id IN (?)", questionClassSubQuery))
// 执行组建
query = query.Where(orQuery)
}
// 排序
if req.Order != nil {
// 点击次数(点击进入详情页的人次)