🎨 优化model
This commit is contained in:
@@ -19,6 +19,10 @@ func (problemService) GetList(p param.GetProblemList) (records entity.Problem, c
|
||||
if p.Keyword != "" {
|
||||
sel.Where("title LIKE ? OR content like ?", "%"+p.Keyword+"%", "%"+p.Keyword+"%")
|
||||
}
|
||||
if p.CategoryIdentity != "" {
|
||||
sel.Joins("RIGHT JOINN problem_category pc on pc.problem_id = problem.id").
|
||||
Where("pc.category_id= (SELECT cb.id FROM category cb WHERE cb.identity = ?)", p.CategoryIdentity)
|
||||
}
|
||||
|
||||
err = sel.Order("updated_at DESC").Find(&records).Offset(-1).Limit(-1).Count(&count).Error
|
||||
return
|
||||
|
Reference in New Issue
Block a user