create_column_setting.go 1.1 KB
package command

import (
	"fmt"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"

	"github.com/astaxie/beego/validation"
)

type CreateColumnSettingCommand struct {
	// 公司id
	CompanyId int `json:"companyId"`
	// 用户uid
	Uid int64 `json:"uid"`
	// 栏目设置描述
	Description string `json:"description"`
	// 栏目设置关联用户名称
	UserName string `json:"userName"`
	// 默认栏目设置
	Value []domain.Column `json:"value"`
	// 无效栏目设置爱
	InvalidValue []domain.Column `json:"invalidValue"`
	// 模块键值
	Key string `json:"key"`
}

//func (createColumnSettingCommand *CreateColumnSettingCommand) Valid(validation *validation.Validation) {
//	_ = validation.SetError("CustomValid", "未实现的自定义认证")
//}

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