权限,列表,详情
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
package validator
|
||||
|
||||
import (
|
||||
"pkg.local/validate"
|
||||
)
|
||||
|
||||
// AuthorityEditValidator 创建/编辑
|
||||
type AuthorityEditValidator struct {
|
||||
Name string `validate:"required"`
|
||||
Type int32 `validate:"required,oneof=1 2 3 4 5"`
|
||||
ServiceId int64 `validate:"required"`
|
||||
Identification string `validate:"required"`
|
||||
IsShow int32 `validate:"required,oneof=1 2"`
|
||||
Id int64
|
||||
ParentId int64
|
||||
Path string
|
||||
Api string
|
||||
ViewPath string
|
||||
Icon string
|
||||
Description string
|
||||
DataBaseStr string
|
||||
DataAll string
|
||||
DataDepartment string
|
||||
DataOneself string
|
||||
DataTreeAll string
|
||||
DataTreeDepartment string
|
||||
DataTreeOneself string
|
||||
}
|
||||
|
||||
// GetMessage 创建/编辑 - 提示消息
|
||||
func (p AuthorityEditValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Name.required": "名称不能为空",
|
||||
"Type.required": "类型不能为空",
|
||||
"ServiceId.required": "服务Id不能为空",
|
||||
"Identification.required": "权限标识不能为空",
|
||||
"IsShow.required": "是否显示不能为空",
|
||||
"Type.oneof": "类型传值不对",
|
||||
"IsShow.oneof": "显示传值不对",
|
||||
}
|
||||
}
|
||||
|
||||
// AuthorityInfoValidator 查看信息
|
||||
type AuthorityInfoValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
}
|
||||
|
||||
// GetMessage 查看信息 - 提示消息
|
||||
func (p AuthorityInfoValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "ID不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
// AuthorityItemsValidator 查看列表
|
||||
type AuthorityItemsValidator struct {
|
||||
ServiceId int64 `validate:"required"`
|
||||
}
|
||||
|
||||
// GetMessage 查看列表 - 提示消息
|
||||
func (p AuthorityItemsValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"ServiceId.required": "服务ID不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
// AuthorityStatusValidator 修改状态
|
||||
type AuthorityStatusValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
Status int32 `validate:"required,oneof=1 2"`
|
||||
Reason string `validate:"required_if=Status 2"`
|
||||
}
|
||||
|
||||
// GetMessage 修改状态 - 提示消息
|
||||
func (p AuthorityStatusValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "ID不能为空",
|
||||
"Status.required": "状态不能为空",
|
||||
"Status.oneof": "状态传值不对",
|
||||
"Reason.required_if": "理由不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
// AuthorityNameItemsValidator 名称列表
|
||||
type AuthorityNameItemsValidator struct {
|
||||
ServiceId int64 `validate:"required"`
|
||||
Type int32
|
||||
}
|
||||
|
||||
// GetMessage 修改状态 - 提示消息
|
||||
func (p AuthorityNameItemsValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"ServiceId.required": "服务ID不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
type AuthoritySortValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
Type int32 `validate:"required,oneof=1 2"`
|
||||
}
|
||||
|
||||
// GetMessage 修改排序 - 提示消息
|
||||
func (p AuthoritySortValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "ID不能为空",
|
||||
"Type.required": "类型不能为空",
|
||||
"Type.oneof": "类型传值错误",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user