role.go 964 字节
package domain

import "time"

const (
	RoleTypeCommon     int = 0 // 角色类型-添加角色
	RoleTypeSystem     int = 1 // 角色类型-系统预制角色HR-BP(不可删除、编辑)
	RoleTypeSuperAdmin int = 2 // 角色类型-系统预制超级管理员(不可删除、编辑)
)

type Role struct {
	Id          int64      `json:"id,string"`
	Name        string     `json:"name"`
	Type        int        `json:"type" pg:",use_zero"`
	Description string     `json:"description"`
	CompanyId   int64      `json:"companyId,string"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	DeletedAt   *time.Time `json:"deletedAt"`
}

type RoleRepository interface {
	Insert(role *Role) (*Role, error)
	Remove(role *Role) (*Role, error)
	FindOne(queryOptions map[string]interface{}) (*Role, error)
	Find(queryOptions map[string]interface{}) (int64, []*Role, error)
	Count(queryOptions map[string]interface{}) (int64, error)
}