forked from free-lancers/electricity_bill_calc_service
fix(report):修复因为没有找到园区概览而出现的错误。
This commit is contained in:
@@ -137,10 +137,13 @@ func (_ReportService) InitializeNewReport(parkId string, period time.Time) (err
|
||||
func (_ReportService) RetreiveReportIndex(rid string) (*model.Report, error) {
|
||||
reports := make([]model.Report, 0)
|
||||
err := global.DBConn.Where(builder.Eq{"id": rid}).Find(&reports)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(reports) > 0 {
|
||||
return &reports[0], nil
|
||||
} else {
|
||||
return nil, err
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user