update_column_setting.go 1.1 KB
package command

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

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

type UpdateColumnSettingCommand struct {
	// 栏目设置id
	ColumnSettingId int64 `json:"columnSettingId"`
	// 公司id
	CompanyId int `json:"companyId"`
	// 用户uid
	Uid int64 `json:"uid"`
	// 选中的栏目
	Selected []domain.Column `json:"selected"`
	// 未选中的栏目
	UnSelected []domain.Column `json:"unselected"`
	// 栏目设置
	Value []domain.Column `json:"value"`
	// 无效栏目设置
	InvalidValue []domain.Column `json:"invalidValue"`
}

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

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