feat: RBAC 基本完成

This commit is contained in:
Blizzard
2025-09-14 21:58:44 +08:00
parent 2ec091bf59
commit 9be75d53fe
35 changed files with 615 additions and 87 deletions
+13 -5
View File
@@ -2,11 +2,12 @@ package system
import (
"errors"
"gorm.io/gorm"
"sundynix-go/global"
common "sundynix-go/model/commom/request"
"sundynix-go/model/system"
systemReq "sundynix-go/model/system/request"
"gorm.io/gorm"
)
type ClientService struct{}
@@ -44,10 +45,17 @@ func (s *ClientService) GetClientList(info systemReq.GetClientList) (list interf
}
func (s *ClientService) DeleteClientByIds(ids common.IdsReq) (err error) {
return global.DB.Delete(&system.Client{}, "id IN ?", ids.Ids).Error
return global.DB.Where("id IN (?)", ids.Ids).Delete(&system.Client{}).Error
}
func (s *ClientService) GetClientById(id int) (client system.Client, err error) {
err = global.DB.Where("id = ?", id).First(&client).Error
return client, err
func (s *ClientService) GetClientById(id string) (client *system.Client, err error) {
var c system.Client
err = global.DB.Where("id = ?", id).First(&c).Error
return &c, err
}
func (s *ClientService) GetClientByClientId(clientId string) (client *system.Client, err error) {
var c system.Client
err = global.DB.Where("client_id = ?", clientId).First(&c).Error
return &c, err
}