提交 v1.3.0 beta

This commit is contained in:
dushixiang
2022-10-23 20:05:13 +08:00
parent 4ff4d37442
commit 112435199a
329 changed files with 18340 additions and 58458 deletions

View File

@ -7,6 +7,8 @@ import (
"next-terminal/server/model"
)
var JobLogRepository = new(jobLogRepository)
type jobLogRepository struct {
baseRepository
}
@ -15,8 +17,16 @@ func (r jobLogRepository) Create(c context.Context, o *model.JobLog) error {
return r.GetDB(c).Create(o).Error
}
func (r jobLogRepository) FindByJobId(c context.Context, jobId string) (o []model.JobLog, err error) {
err = r.GetDB(c).Where("job_id = ?", jobId).Order("timestamp asc").Find(&o).Error
func (r jobLogRepository) FindByJobId(c context.Context, jobId string, pageIndex, pageSize int) (o []model.JobLog, total int64, err error) {
err = r.GetDB(c).Table("job_logs").Where("job_id = ?", jobId).Count(&total).Error
if err != nil {
return nil, 0, err
}
err = r.GetDB(c).Where("job_id = ?", jobId).Order("timestamp desc").Find(&o).Offset((pageIndex - 1) * pageSize).Limit(pageSize).Error
if o == nil {
o = make([]model.JobLog, 0)
}
return
}