30 lines
733 B
Go
30 lines
733 B
Go
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
|
|
}
|