Merge branch 'sxy' into dev
This commit is contained in:
commit
2baa91db73
@ -80,12 +80,19 @@ func RecordList(in *exhibition.RecordListReq) (data []*model.RegisterRecord, tot
|
||||
if total == 0 {
|
||||
return
|
||||
}
|
||||
sortBy := "create_at %s,id %s"
|
||||
// sortBy := "created_at desc,id desc"
|
||||
// if in.SortKey == 1 {
|
||||
// sortBy = fmt.Sprintf(sortBy, "ASC", "ASC")
|
||||
// }
|
||||
// if in.SortKey == 2 {
|
||||
// sortBy = fmt.Sprintf(sortBy, "DESC", "DESC")
|
||||
// }
|
||||
sortBy := "created_at desc,id desc"
|
||||
if in.SortKey == 1 {
|
||||
sortBy = fmt.Sprintf(sortBy, "ASC", "ASC")
|
||||
sortBy = fmt.Sprintf("created_at %s,id %s", in.Sort, in.Sort)
|
||||
}
|
||||
if in.SortKey == 2 {
|
||||
sortBy = fmt.Sprintf(sortBy, "DESC", "DESC")
|
||||
sortBy = fmt.Sprintf("updated_at %s,id %s", in.Sort, in.Sort)
|
||||
}
|
||||
|
||||
if err = dbLink.Order(sortBy).Limit(int(in.PageSize)).Offset(int(offset)).Find(&data).Error; err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user