import_data_command.go 788 字节
package command

import (
	"fmt"
	"github.com/beego/beego/v2/core/validation"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
	"io"
)

type ImportDataCommand struct {
	//操作人
	Operator *domain.OperateInfo `json:"-"`
	Reader   io.Reader           `json:"-"`
	FileExt  string              `json:"-"`
	// 业务编码
	Code string `form:"code"`
}

func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) {

}

func (importDataCommand *ImportDataCommand) ValidateCommand() error {
	valid := validation.Validation{}
	b, err := valid.Valid(importDataCommand)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}