approveflow/app/http/module/flow_definition/dto.go

30 lines
733 B
Go
Raw Permalink Normal View History

2024-11-14 17:02:41 +08:00
package flow_definition
import (
"approveflow/app/provider/flow_definition"
"approveflow/app/utils"
)
type ApprovalFlowDTO struct {
ID int64 `json:"id"` // 主键ID
Name string `json:"name"` // 流程名称
Description string `json:"description"` // 流程描述
}
func ApprovalFlowDTOConvert(flow *flow_definition.ApprovalFlow) *ApprovalFlowDTO {
dto := &ApprovalFlowDTO{}
err := utils.Convert(flow, dto)
if err != nil {
return nil
}
return dto
}
func ApprovalFlowDTOConvertBatch(flow []*flow_definition.ApprovalFlow) []*ApprovalFlowDTO {
res := make([]*ApprovalFlowDTO, 0)
for _, flowEntity := range flow {
res = append(res, ApprovalFlowDTOConvert(flowEntity))
}
return res
}