package impl

import (
	"ai_scheduler/internal/data/model"
	"ai_scheduler/tmpl/dataTemp"
	"ai_scheduler/utils"
	"gorm.io/gorm"
)

type SysImpl struct {
	dataTemp.DataTemp
	BaseRepository[model.AiSy]
}

func NewSysImpl(db *utils.Db) *SysImpl {
	return &SysImpl{
		DataTemp:       *dataTemp.NewDataTemp(db, new(model.AiSy)),
		BaseRepository: NewBaseModel[model.AiSy](db.Client),
	}
}

// WithSysId 系统id
func (s *SysImpl) WithSysId(sysId interface{}) CondFunc {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("sys_id = ?", sysId)
	}
}
