审查视图

pkg/application/role/command/role_delete.go 390 字节
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package command

import "github.com/beego/beego/v2/core/validation"

type DeleteRoleCommand struct {
	CompanyId int64 `cname:"公司ID" json:"companyId"`
	Id        int64 `cname:"角色ID" json:"id,string" valid:"Required"`
}

func (in *DeleteRoleCommand) Valid(validation *validation.Validation) {
	if in.CompanyId == 0 {
		validation.SetError("companyId", "公司ID无效")
		return
	}
}