用户juese
This commit is contained in:
@@ -133,3 +133,15 @@ func UpdateRole(ctx *jxcontext.Context, roleID int, name string, isDelete bool)
|
||||
dao.Commit(db)
|
||||
return num, err
|
||||
}
|
||||
|
||||
func GetUserRole(ctx *jxcontext.Context, userID string) (userRoles []*model.UserRole, err error) {
|
||||
return dao.GetUserRole(dao.GetDB(), userID)
|
||||
}
|
||||
|
||||
func UpdateUserRole(ctx *jxcontext.Context, userIDs []string, roleIDs []int) (err error) {
|
||||
// var (
|
||||
// db = dao.GetDB()
|
||||
// )
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -42,3 +42,20 @@ func GetRole(db *DaoDB, name string) (roles []*model.Role, err error) {
|
||||
err = GetRows(db, &roles, sql, sqlParams)
|
||||
return roles, err
|
||||
}
|
||||
|
||||
func GetUserRole(db *DaoDB, userID string) (userRoles []*model.UserRole, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM user_role
|
||||
WHERE deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if userID != "" {
|
||||
sql += " AND user_id = ?"
|
||||
sqlParams = append(sqlParams, userID)
|
||||
}
|
||||
err = GetRows(db, &userRoles, sql, sqlParams)
|
||||
return userRoles, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user