修改查询 已阅和待阅读 2.0

main
jhc 1 year ago
parent fb40e8f200
commit 8230c35dea

@ -686,11 +686,7 @@ func MySubmitApprovals(in *approval.ListRequest) ([]*Approval, int64) {
Preload("Exhibition.ApprovalExhibitions") Preload("Exhibition.ApprovalExhibitions")
if in.Status != 0 { if in.Status != 0 {
if in.Status == 6 { modelObj = modelObj.Where(&Approval{Status: int8(in.Status)})
modelObj.Where("status in ?", []int{4, 5})
} else {
modelObj = modelObj.Where(&Approval{Status: int8(in.Status)})
}
} }
if in.Type != "" { if in.Type != "" {

@ -98,11 +98,17 @@ func BuildApproval(entity *model.Approval, userId uint64) *approval.CreateReques
} }
//BuildApprovals 处理单个detail返回 //BuildApprovals 处理单个detail返回
func BuildApprovals(list []*model.Approval, userId uint64) (details []*approval.CreateRequest) { func BuildApprovals(list []*model.Approval, userId uint64, status int) (details []*approval.CreateRequest) {
for _, item := range list { for _, item := range list {
temp := BuildApproval(item, userId) temp := BuildApproval(item, userId)
details = append(details, temp) if status == 6 {
if temp.AllStatus == 4 || temp.AllStatus == 5 {
details = append(details, temp)
}
} else {
details = append(details, temp)
}
} }
return details return details

@ -251,7 +251,7 @@ func (a *ApprovalProvider) MySubmit(ctx context.Context, in *approval.ListReques
list, count = model.MySubmitApprovals(in) list, count = model.MySubmitApprovals(in)
response.Count = uint64(count) response.Count = uint64(count)
response.Data = serializer.BuildApprovals(list, in.UserID) response.Data = serializer.BuildApprovals(list, in.UserID, 0)
return response, nil return response, nil
} }
@ -263,14 +263,14 @@ func (a *ApprovalProvider) MyWork(ctx context.Context, in *approval.ListRequest)
var list []*model.Approval var list []*model.Approval
var count int64 var count int64
if in.Status == 0 && in.ApprovedBossId == 0 { if (in.Status == 0 || in.Status == 6) && in.ApprovedBossId == 0 {
list, count = model.MyAllWorkApprovals(in) list, count = model.MyAllWorkApprovals(in)
} else { } else {
list, count = model.MyWorkApprovals(in) list, count = model.MyWorkApprovals(in)
} }
response.Count = uint64(count) response.Count = uint64(count)
response.Data = serializer.BuildApprovals(list, in.UserID) response.Data = serializer.BuildApprovals(list, in.UserID, int(in.Status))
return response, nil return response, nil
} }

Loading…
Cancel
Save