Cron_Admin/app/services/cron_func_logs_service.go

27 lines
712 B
Go

package services
import (
"cron_admin/app/http/entities/backend"
"cron_admin/app/models/cronfunclogsmodel"
"xorm.io/builder"
)
func CronFuncLogsList(request *backend.CronFuncLogsListRequest, page int, limit int) (count int64, listInfo []cronfunclogsmodel.CronFuncLogs, err error) {
conn := builder.NewCond()
if request.CmdId != 0 {
conn = conn.And(builder.Eq{"CmdId": request.CmdId})
}
if request.Status != 0 {
conn = conn.And(builder.Eq{"Status": request.Status})
}
session := cronfunclogsmodel.GetInstance().GetDb().Where(conn)
if page != 0 && limit != 0 {
session = session.Limit(limit, (page-1)*limit)
}
count, err = session.FindAndCount(&listInfo)
if err != nil {
return
}
return
}