main
jhc 1 year ago
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 {
//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…
Cancel
Save