fix(report):修正精简组装报表查询语句。

This commit is contained in:
徐涛 2022-09-19 14:41:49 +08:00
parent d98e782f12
commit 7f585c0452

View File

@ -602,19 +602,12 @@ func (_ReportService) AssembleReportPublicity(reportId string) (*model.Publicity
var report = new(model.Report)
err := global.DB.NewSelect().Model(report).
Relation("Summary").Relation("WillDilutedFees").Relation("EndUsers").
Relation("Park").
Relation("Park").Relation("Park.Enterprise").
Where("r.id = ?", reportId).
Scan(ctx)
if err != nil {
return nil, exceptions.NewNotFoundErrorFromError("未找到指定的公示报表", err)
}
var enterprise = new(model.UserDetail)
err = global.DB.NewSelect().Model(enterprise).
Where("id = ?", report.Park.UserId).
Scan(ctx)
if err != nil {
return nil, exceptions.NewNotFoundErrorFromError("未找到指定公示报表对应的用户信息", err)
}
// 组合数据
paidPart := model.PaidPart{
@ -729,7 +722,7 @@ func (_ReportService) AssembleReportPublicity(reportId string) (*model.Publicity
publicity := &model.Publicity{
Report: *report,
Park: *report.Park,
User: *enterprise,
User: *report.Park.Enterprise,
Paid: paidPart,
EndUser: endUserSummary,
Loss: lossPart,