Files
ai-agent/internal/services/system_config_service.go
T
t 2bbf42b741 refactor(auth): delegate access control to be-system
Remove Agent Desk users, roles, login sessions, tokens, and local permission persistence. Expose the backend as an embeddable ai-agent module with host-provided subject lookup and operation authorization callbacks, and complete the frontend/backend repository split.
2026-08-21 00:41:07 +08:00

68 lines
2.2 KiB
Go

package services
import (
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/repositories"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/httpx/params"
"github.com/mlogclub/simple/sqls"
)
var SystemConfigService = newSystemConfigService()
func newSystemConfigService() *systemConfigService {
return &systemConfigService{}
}
type systemConfigService struct {
}
func (s *systemConfigService) Get(id int64) *models.SystemConfig {
return repositories.SystemConfigRepository.Get(sqls.DB(), id)
}
func (s *systemConfigService) Take(where ...interface{}) *models.SystemConfig {
return repositories.SystemConfigRepository.Take(sqls.DB(), where...)
}
func (s *systemConfigService) Find(cnd *sqls.Cnd) []models.SystemConfig {
return repositories.SystemConfigRepository.Find(sqls.DB(), cnd)
}
func (s *systemConfigService) FindOne(cnd *sqls.Cnd) *models.SystemConfig {
return repositories.SystemConfigRepository.FindOne(sqls.DB(), cnd)
}
func (s *systemConfigService) FindPageByParams(params *params.QueryParams) (list []models.SystemConfig, paging *sqls.Paging) {
return repositories.SystemConfigRepository.FindPageByParams(sqls.DB(), params)
}
func (s *systemConfigService) FindPageByCnd(cnd *sqls.Cnd) (list []models.SystemConfig, paging *sqls.Paging) {
return repositories.SystemConfigRepository.FindPageByCnd(sqls.DB(), cnd)
}
func (s *systemConfigService) Count(cnd *sqls.Cnd) int64 {
return repositories.SystemConfigRepository.Count(sqls.DB(), cnd)
}
func (s *systemConfigService) Create(t *models.SystemConfig) error {
return repositories.SystemConfigRepository.Create(sqls.DB(), t)
}
func (s *systemConfigService) Update(t *models.SystemConfig) error {
return repositories.SystemConfigRepository.Update(sqls.DB(), t)
}
func (s *systemConfigService) Updates(id int64, columns map[string]interface{}) error {
return repositories.SystemConfigRepository.Updates(sqls.DB(), id, columns)
}
func (s *systemConfigService) UpdateColumn(id int64, name string, value interface{}) error {
return repositories.SystemConfigRepository.UpdateColumn(sqls.DB(), id, name, value)
}
func (s *systemConfigService) Delete(id int64) {
repositories.SystemConfigRepository.Delete(sqls.DB(), id)
}