48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package serializer
|
|
|
|
import (
|
|
"github.com/fonchain_enterprise/fonchain-approval/api/approval"
|
|
"github.com/fonchain_enterprise/fonchain-approval/pkg/model"
|
|
)
|
|
|
|
//BuildApproval 处理单个detail返回
|
|
func BuildApproval(entity *model.Approval) *approval.ApprovalRequest {
|
|
var work *approval.Work
|
|
var show *approval.Show
|
|
var exhibition *approval.Exhibition
|
|
var bundle *approval.Bundle
|
|
|
|
response := &approval.ApprovalRequest{
|
|
ID: entity.ID,
|
|
Domain: *entity.Domain,
|
|
Status: uint64(entity.Status),
|
|
Type: entity.Type,
|
|
ApproverID: entity.ApproverID,
|
|
ApproverName: entity.ApproverName,
|
|
CopyUsers: model.FormatToResponse(entity.CopyUsers),
|
|
SubmitterID: entity.SubmitterID,
|
|
SubmitterName: entity.SubmitterName,
|
|
Content: entity.Content,
|
|
Reply: entity.Reply,
|
|
Work: work,
|
|
Show: show,
|
|
Exhibition: exhibition,
|
|
Bundle: bundle,
|
|
}
|
|
|
|
_ = entity.SetResContent(response)
|
|
|
|
return response
|
|
}
|
|
|
|
//BuildApprovals 处理单个detail返回
|
|
func BuildApprovals(list []*model.Approval) (details []*approval.ApprovalRequest) {
|
|
|
|
for _, item := range list {
|
|
temp := BuildApproval(item)
|
|
details = append(details, temp)
|
|
}
|
|
|
|
return details
|
|
}
|