判断获取到数据

This commit is contained in:
Mr.Li 2023-04-11 15:08:07 +08:00
parent 8eced162b9
commit 84b81fb98c
2 changed files with 8 additions and 2 deletions

View File

@ -42,8 +42,9 @@ func (ee *ExcelExporter) Export(sql, pk string) error {
ee.file.Write(last)
}
ee.last = last[getPkIndex(data.Title, pk)]
if len(last) > 0 {
ee.last = last[getPkIndex(data.Title, pk)]
}
//ee.file.Close()
return nil
}

View File

@ -66,6 +66,11 @@ func (e *Excel) TaskExport(d export.DataFetcher, t config.Task, params map[strin
count, last := e.Last()
fmt.Printf("已导出 %d 条数据\n", batch*i+count)
if count == 0 {
return nil
}
if count < batch {
break
}