79614b2d07
- Updated multiple repository and service files to replace imports from "github.com/mlogclub/simple/web/params" with "cs-agent/internal/pkg/httpx/params". - Adjusted context handling in auth_service and ws_service to use gin.Context instead of iris.Context. - Ensured consistent usage of HTTP status responses across websocket handlers.
67 lines
2.1 KiB
Go
67 lines
2.1 KiB
Go
package services
|
|
|
|
import (
|
|
"cs-agent/internal/models"
|
|
"cs-agent/internal/repositories"
|
|
|
|
"cs-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)
|
|
}
|