修改
This commit is contained in:
parent
f3327d15b5
commit
b9e7ccc9a4
@ -10,7 +10,6 @@ import (
|
||||
msg "github.com/fonchain_enterprise/fonchain-approval/pkg/m"
|
||||
"github.com/jinzhu/copier"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/plugin/soft_delete"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -647,13 +646,13 @@ func MyAllWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
||||
|
||||
modelObj.Count(&count)
|
||||
|
||||
if len(ids) > 0 { //根据具体id排序
|
||||
modelObj = modelObj.Clauses(clause.OrderBy{
|
||||
Expression: clause.Expr{SQL: "FIELD(id,?) " + in.OrderBy, Vars: []interface{}{ids}, WithoutParentheses: true},
|
||||
})
|
||||
} else {
|
||||
modelObj = modelObj.Order("id " + in.OrderBy)
|
||||
}
|
||||
//if len(ids) > 0 { //根据具体id排序
|
||||
// modelObj = modelObj.Clauses(clause.OrderBy{
|
||||
// Expression: clause.Expr{SQL: "FIELD(id,?) " + in.OrderBy, Vars: []interface{}{ids}, WithoutParentheses: true},
|
||||
// })
|
||||
//} else {
|
||||
modelObj = modelObj.Order("id " + in.OrderBy)
|
||||
//}
|
||||
|
||||
modelObj.Limit(int(in.PageSize)).Offset(page.GetOffset(in.Page, in.PageSize)).Find(&list)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user