修改查询 已阅和待阅读
This commit is contained in:
parent
229ef3e809
commit
3a99d797d5
@ -11,6 +11,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/plugin/soft_delete"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -168,7 +169,7 @@ func ExistPayApproval(in *approval.CreateRequest) bool {
|
||||
|
||||
//
|
||||
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")
|
||||
|
||||
DB.Model(&BundlePayPrice{}).Where("approval_id in (?)", subQuery1).Where(&BundlePayPrice{ShowUid: in.BundlePayPrice.ShowUid}).Count(&count)
|
||||
@ -541,7 +542,7 @@ func MyAllWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
||||
|
||||
modelObj = modelObj.Where(&Approval{Type: in.Type}).Where(
|
||||
DB.Where(&Approval{NowUserId: in.UserID, Status: StatusDoing}). // 我需要审批的
|
||||
Or(DB.Where("status = ?", StatusOk).Where("id in (?)", s1))) // 已完成,抄送给我的
|
||||
Or(DB.Where("status = ?", StatusOk).Where("id in (?)", s1))) // 已完成,抄送给我的
|
||||
modelObj.Count(&count)
|
||||
|
||||
if len(ids) > 0 { //根据具体id排序
|
||||
@ -586,8 +587,8 @@ func MyApprovalWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
||||
if in.UserID != 0 {
|
||||
modelObj = modelObj.Where(
|
||||
DB.Where("JSON_CONTAINS(approval_users,JSON_OBJECT('ID', ?))", in.UserID).
|
||||
Where("status != ?", StatusDoing). //完成,我参与审批
|
||||
Or(DB.Where("now_user_id", in.UserID).Where("status = ?", StatusDoing)). //进行中,当前审批人是我,
|
||||
Where("status != ?", StatusDoing). //完成,我参与审批
|
||||
Or(DB.Where("now_user_id", in.UserID).Where("status = ?", StatusDoing)). //进行中,当前审批人是我,
|
||||
Or(DB.Where("JSON_CONTAINS(copy_users,JSON_OBJECT('ID', ?))", in.UserID).Where("status = ?", StatusOk))) //抄送人(完成抄送)
|
||||
}
|
||||
|
||||
@ -643,8 +644,8 @@ func MyWorkApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
||||
if in.UserID != 0 {
|
||||
modelObj = modelObj.Where(
|
||||
DB.Where("JSON_CONTAINS(approval_users,JSON_OBJECT('ID', ?))", in.UserID).
|
||||
Where("status != ?", StatusDoing). //完成,我参与审批
|
||||
Or(DB.Where("now_user_id", in.UserID).Where("status = ?", StatusDoing)). //进行中,当前审批人是我,
|
||||
Where("status != ?", StatusDoing). //完成,我参与审批
|
||||
Or(DB.Where("now_user_id", in.UserID).Where("status = ?", StatusDoing)). //进行中,当前审批人是我,
|
||||
Or(DB.Where("JSON_CONTAINS(copy_users,JSON_OBJECT('ID', ?))", in.UserID).Where("status = ?", StatusOk))) //抄送人(完成抄送)
|
||||
}
|
||||
|
||||
@ -690,7 +691,11 @@ func MySubmitApprovals(in *approval.ListRequest) ([]*Approval, int64) {
|
||||
}
|
||||
|
||||
if in.Type != "" {
|
||||
modelObj = modelObj.Where(&Approval{Type: 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{SubmitterID: in.UserID})
|
||||
|
Loading…
Reference in New Issue
Block a user