修改查询 已阅和待阅读
This commit is contained in:
parent
229ef3e809
commit
3a99d797d5
@ -11,6 +11,7 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"gorm.io/plugin/soft_delete"
|
"gorm.io/plugin/soft_delete"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -168,7 +169,7 @@ func ExistPayApproval(in *approval.CreateRequest) bool {
|
|||||||
|
|
||||||
//
|
//
|
||||||
subQuery1 := DB.Model(&Approval{}).Where(&Approval{SubmitterID: in.SubmitterID, Type: TypeBundlePayPrice}).
|
subQuery1 := DB.Model(&Approval{}).Where(&Approval{SubmitterID: in.SubmitterID, Type: TypeBundlePayPrice}).
|
||||||
Where("status in (?)",[]uint64{StatusDoing,StatusOk}).
|
Where("status in (?)", []uint64{StatusDoing, StatusOk}).
|
||||||
Select("id")
|
Select("id")
|
||||||
|
|
||||||
DB.Model(&BundlePayPrice{}).Where("approval_id in (?)", subQuery1).Where(&BundlePayPrice{ShowUid: in.BundlePayPrice.ShowUid}).Count(&count)
|
DB.Model(&BundlePayPrice{}).Where("approval_id in (?)", subQuery1).Where(&BundlePayPrice{ShowUid: in.BundlePayPrice.ShowUid}).Count(&count)
|
||||||
@ -690,8 +691,12 @@ func MySubmitApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if in.Type != "" {
|
if in.Type != "" {
|
||||||
|
if len(strings.Split(in.Type, ",")) > 1 {
|
||||||
|
modelObj.Where("`type` in ?", strings.Split(in.Type, ","))
|
||||||
|
} else {
|
||||||
modelObj = modelObj.Where(&Approval{Type: in.Type})
|
modelObj = modelObj.Where(&Approval{Type: in.Type})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modelObj = modelObj.Where(&Approval{SubmitterID: in.UserID})
|
modelObj = modelObj.Where(&Approval{SubmitterID: in.UserID})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user