提交 v1.3.0 beta
This commit is contained in:
30
server/repository/user_role_ref.go
Normal file
30
server/repository/user_role_ref.go
Normal file
@ -0,0 +1,30 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"next-terminal/server/model"
|
||||
)
|
||||
|
||||
var UserRoleRefRepository = new(userRoleRefRepository)
|
||||
|
||||
type userRoleRefRepository struct {
|
||||
baseRepository
|
||||
}
|
||||
|
||||
func (r userRoleRefRepository) Create(c context.Context, m *model.UserRoleRef) error {
|
||||
return r.GetDB(c).Create(m).Error
|
||||
}
|
||||
|
||||
func (r userRoleRefRepository) DeleteByUserId(c context.Context, userId string) error {
|
||||
return r.GetDB(c).Where("user_id = ?", userId).Delete(model.UserRoleRef{}).Error
|
||||
}
|
||||
|
||||
func (r userRoleRefRepository) FindByUserId(c context.Context, userId string) (items []model.UserRoleRef, err error) {
|
||||
err = r.GetDB(c).Where("user_id = ?", userId).Find(&items).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r userRoleRefRepository) DeleteByRoleId(c context.Context, roleId string) error {
|
||||
return r.GetDB(c).Where("role_id = ?", roleId).Delete(model.UserRoleRef{}).Error
|
||||
}
|
Reference in New Issue
Block a user