dao

package
v0.0.0-...-23f538b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const EntityName = "权限"

Variables

This section is empty.

Functions

This section is empty.

Types

type Member

type Member struct {
	Id           string    // id
	Email        string    // 邮箱
	Name         string    // 昵称
	LoginName    string    // 用户名
	Password     string    // 密码
	Sex          string    // 性别
	Photo        string    // 用户头像
	Integral     uint32    // 积分
	LearningTime uint32    // 学习时长
	RegisterTime time.Time // 注册时间
	CreateTime   time.Time // 创建时间
	UpdateTime   time.Time // 更新时间
	Creator      string    // 创建者
	Updater      string    // 更新者
}

func (Member) TableName

func (Member) TableName() string

type MemberDao

type MemberDao struct {
}

func (*MemberDao) Create

func (m *MemberDao) Create(member *Member) *public.BusinessException

func (*MemberDao) SavePassword

func (m *MemberDao) SavePassword(ctx context.Context, updatePass *dto.UpdatePass) *public.BusinessException

SavePassword : reset password

func (*MemberDao) SelectByProperty

func (m *MemberDao) SelectByProperty(member *[]*Member, property string, val interface{}) *public.BusinessException

func (*MemberDao) UpdateEmail

func (m *MemberDao) UpdateEmail(ctx context.Context, in *dto.UpdateEmail) *public.BusinessException

UpdateEmail: 更新邮箱

type Resource

type Resource struct {
	Id         int32
	Parent     int32
	Type       int32
	Title      string
	Label      string
	Name       string
	Component  string
	Sort       int32
	Icon       string
	Path       string
	SubCount   int32
	IFrame     bool
	Cache      bool
	Hidden     bool
	Permission string
	CreateBy   string
	UpdateBy   string
	CreateTime time.Time
	UpdateTime time.Time
}

func (Resource) TableName

func (Resource) TableName() string

type ResourceDao

type ResourceDao struct {
}

func (*ResourceDao) Delete

func (r *ResourceDao) Delete(ctx context.Context, ids []int32) *public.BusinessException

Delete : 删除权限

func (*ResourceDao) FindUserResources

func (r *ResourceDao) FindUserResources(ctx context.Context, userId string) ([]*dto.ResourceDto, *public.BusinessException)

FindUserResources 获取用户的权限

func (*ResourceDao) GetByParent

func (r *ResourceDao) GetByParent(ctx context.Context, pid int32) ([]*dto.ResourceDto, *public.BusinessException)

GetByParent : 通过父ID parent查询权限

func (*ResourceDao) GetChildMenus

func (r *ResourceDao) GetChildMenus(ctx context.Context, ids []int32, resourceSet *public.HashSet) *public.BusinessException

GetChildMenus: 获取传入父 ID 的所有子权限

func (*ResourceDao) GetSuperior

func (r *ResourceDao) GetSuperior(ctx context.Context, ids []int32) ([]*dto.ResourceDto, *public.BusinessException)

GetSuperior: 获取同级和父级的权限

func (*ResourceDao) List

List: 分页数据

func (*ResourceDao) Save

Save: 保存/更新资源

func (*ResourceDao) SelectByProperty

func (r *ResourceDao) SelectByProperty(ctx context.Context, property string, value interface{}) (*dto.ResourceDto, *public.BusinessException)

SelectByProperty: 通过 一个属性 获取权限

func (*ResourceDao) SelectPermissionByUserId

func (r *ResourceDao) SelectPermissionByUserId(ctx context.Context, userId string) ([]string, *public.BusinessException)

SelectPermissionByUserId: 获取permission字段

type Role

type Role struct {
	Id         string
	Name       string
	Desc       string
	Level      int32
	CreateTime time.Time
}

func (Role) TableName

func (Role) TableName() string

type RoleDao

type RoleDao struct {
}

func (*RoleDao) All

All: 获取所有角色

func (*RoleDao) Delete

func (r *RoleDao) Delete(ctx context.Context, ids []string) *public.BusinessException

Delete 删除角色

func (*RoleDao) List

List: 获取角色列表

func (*RoleDao) ListRoleResource

func (r *RoleDao) ListRoleResource(ctx context.Context, roleId string) ([]int32, *public.BusinessException)

ListRoleResource: 获取角色所有权限

func (*RoleDao) ListRoleUser

func (r *RoleDao) ListRoleUser(ctx context.Context, roleId string) ([]string, *public.BusinessException)

ListRoleUser: 获取角色所有用户

func (*RoleDao) Save

Save : update when rr.id exists, insert otherwise

func (*RoleDao) SaveRoleResource

func (r *RoleDao) SaveRoleResource(ctx context.Context, rt *dto.RoleDto) *public.BusinessException

SaveRoleResource: 保存角色资源关联记录

func (*RoleDao) SaveRoleUser

func (r *RoleDao) SaveRoleUser(ctx context.Context, rt *dto.RoleDto) *public.BusinessException

SaveRoleUser: 保存角色的所有用户

func (*RoleDao) SelectById

func (r *RoleDao) SelectById(ctx context.Context, id string) (*dto.RoleDto, *public.BusinessException)

SelectById: 获取传入 ID 角色

func (*RoleDao) SelectByUserId

func (r *RoleDao) SelectByUserId(userId string) ([]Role, *public.BusinessException)

SelectByUserId: 获取用户角色

type RoleResource

type RoleResource struct {
	Id         int32
	RoleId     string
	ResourceId int32
}

func (RoleResource) TableName

func (RoleResource) TableName() string

type RoleResourceDao

type RoleResourceDao struct {
}

func (*RoleResourceDao) DeleteByResources

func (r *RoleResourceDao) DeleteByResources(ctx context.Context, ids []int32) *public.BusinessException

DeleteByResources: 通过权限 id 删除记录

func (*RoleResourceDao) DeleteByRoleId

func (r *RoleResourceDao) DeleteByRoleId(ctx context.Context, roleIds []string) *public.BusinessException

DeleteByRoleId: 删除角色关联的所有记录

func (*RoleResourceDao) Save

Save: 创建角色-资源关联记录

func (*RoleResourceDao) SelectByRoleId

func (r *RoleResourceDao) SelectByRoleId(ctx context.Context, roleId string) ([]int32, *public.BusinessException)

SelectByRoleId: 查询角色关联的所有记录

type RoleUser

type RoleUser struct {
	Id     string
	RoleId string
	UserId string
}

func (RoleUser) TableName

func (RoleUser) TableName() string

type RoleUserDao

type RoleUserDao struct {
}

func (*RoleUserDao) BatchInsert

func (r *RoleUserDao) BatchInsert(ctx context.Context, rts []RoleUser) *public.BusinessException

BatchInsert: 创建角色-用户关联记录 批量

func (*RoleUserDao) DeleteByRoleId

func (r *RoleUserDao) DeleteByRoleId(ctx context.Context, roleId string) *public.BusinessException

DeleteByRoleId: 删除角色关联的所有记录

func (*RoleUserDao) DeleteByUserId

func (r *RoleUserDao) DeleteByUserId(ctx context.Context, userId string) *public.BusinessException

DeleteByUserId: 删除用户角色记录

func (*RoleUserDao) Save

Save: 创建角色-用户关联记录

func (*RoleUserDao) SelectByRoleId

func (r *RoleUserDao) SelectByRoleId(ctx context.Context, roleId string) ([]string, *public.BusinessException)

SelectByRoleId: 查询角色关联的所有记录

type User

type User struct {
	Id         string
	Name       string
	LoginName  string
	Password   string
	Gender     string
	Phone      string
	Email      string
	AvatarName string
	AvatarPath string
	IsAdmin    bool
	CreateBy   string
	CreateTime time.Time
	UpdateBy   string
	UpdateTime time.Time
}

func (User) TableName

func (User) TableName() string

type UserDao

type UserDao struct {
}

func (*UserDao) CountByRoles

func (u *UserDao) CountByRoles(ctx context.Context, roles []string) int64

CountByRoles: 查询角色是否关联了用户

func (*UserDao) Create

func (u *UserDao) Create(ctx context.Context, userDto *User) (*User, *public.BusinessException)

Create: 创建新用户

func (*UserDao) Delete

func (u *UserDao) Delete(ctx context.Context, ids []string) *public.BusinessException

Delete 删除用户

func (*UserDao) List

List : get user page

func (*UserDao) Login

Login : login

func (*UserDao) SavePassword

func (u *UserDao) SavePassword(ctx context.Context, updatePass *dto.UpdatePass) *public.BusinessException

SavePassword : reset password

func (*UserDao) SelectByEmail

func (u *UserDao) SelectByEmail(ctx context.Context, email string) *dto.UserDto

func (*UserDao) SelectById

func (u *UserDao) SelectById(ctx context.Context, id string) *User

SelectById : get user by id

func (*UserDao) SelectByLoginName

func (u *UserDao) SelectByLoginName(ctx context.Context, loginName string) *User

SelectByLoginName : get user by login name

func (*UserDao) SelectByPhone

func (u *UserDao) SelectByPhone(ctx context.Context, phone string) *dto.UserDto

func (*UserDao) Update

func (u *UserDao) Update(ctx context.Context, userDto *User) (*User, *public.BusinessException)

Update : 更新用户

func (*UserDao) UpdateEmail

func (u *UserDao) UpdateEmail(ctx context.Context, in *dto.UpdateEmail) *public.BusinessException

UpdateEmail: 更新邮箱

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL