修改问答题库 排序
This commit is contained in:
parent
2539717a1f
commit
9c3026fff2
@ -165,6 +165,22 @@ func (r *QuestionQaDao) GetQuestionQaPageSearch(req requests.GetQuestionQaPage,
|
||||
|
||||
// 排序
|
||||
if req.Order != nil {
|
||||
if req.Order.QaExpireTime != "" {
|
||||
if req.Order.QaExpireTime != "desc" && req.Order.QaExpireTime != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
}
|
||||
|
||||
query = query.Order("qa_expire_time " + req.Order.QaExpireTime)
|
||||
}
|
||||
|
||||
if req.Order.QaQuantity != "" {
|
||||
if req.Order.QaQuantity != "desc" && req.Order.QaQuantity != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
}
|
||||
|
||||
query = query.Order("qa_quantity " + req.Order.QaQuantity)
|
||||
}
|
||||
|
||||
if req.Order.UpdatedAt != "" {
|
||||
if req.Order.UpdatedAt != "desc" && req.Order.UpdatedAt != "asc" {
|
||||
return nil, 0, errors.New("排序字段错误")
|
||||
|
||||
@ -26,7 +26,9 @@ type GetQuestionQaPage struct {
|
||||
|
||||
// GetQuestionQaPageOrder 获取题目列表-分页-排序条件
|
||||
type GetQuestionQaPageOrder struct {
|
||||
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
||||
UpdatedAt string `json:"updated_at" form:"updated_at" label:"排序"`
|
||||
QaExpireTime string `json:"qa_expire_time" form:"qa_expire_time" label:"排序"` // 有效期
|
||||
QaQuantity string `json:"qa_quantity" form:"qa_quantity" label:"排序"` // 题数
|
||||
}
|
||||
|
||||
// AddQuestionQa 新增问答题库
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user