初始化项目
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitee.com/red-future---jilin-g/common/http"
|
||||
|
||||
"cidservice/model/dto"
|
||||
"cidservice/service"
|
||||
)
|
||||
|
||||
type report struct{}
|
||||
|
||||
var Report = new(report)
|
||||
|
||||
// Create 创建报表
|
||||
func (c *report) Create(ctx context.Context, req *dto.CreateReportReq) (res *dto.CreateReportRes, err error) {
|
||||
return service.Report.Create(ctx, req)
|
||||
}
|
||||
|
||||
// GetOne 获取报表详情
|
||||
func (c *report) GetOne(ctx context.Context, req *dto.GetReportReq) (res *dto.GetReportRes, err error) {
|
||||
return service.Report.GetOne(ctx, req)
|
||||
}
|
||||
|
||||
// List 获取报表列表
|
||||
func (c *report) List(ctx context.Context, req *dto.ListReportReq) (res *dto.ListReportRes, err error) {
|
||||
return service.Report.List(ctx, req)
|
||||
}
|
||||
|
||||
// Update 更新报表
|
||||
func (c *report) Update(ctx context.Context, req *dto.UpdateReportReq) (res *http.ResponseEmpty, err error) {
|
||||
err = service.Report.Update(ctx, req)
|
||||
res = &http.ResponseEmpty{}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除报表
|
||||
func (c *report) Delete(ctx context.Context, req *dto.DeleteReportReq) (res *http.ResponseEmpty, err error) {
|
||||
err = service.Report.Delete(ctx, req)
|
||||
res = &http.ResponseEmpty{}
|
||||
return
|
||||
}
|
||||
|
||||
// Download 下载报表
|
||||
func (c *report) Download(ctx context.Context, req *dto.DownloadReportReq) (res *dto.DownloadReportRes, err error) {
|
||||
return service.Report.Download(ctx, req)
|
||||
}
|
||||
|
||||
// Generate 生成报表
|
||||
func (c *report) Generate(ctx context.Context, req *dto.GenerateReportReq) (res *http.ResponseEmpty, err error) {
|
||||
err = service.Report.Generate(ctx, req)
|
||||
res = &http.ResponseEmpty{}
|
||||
return
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cidservice/model/dto"
|
||||
"cidservice/service"
|
||||
@@ -18,6 +19,8 @@ func (c *statReport) GenerateReport(ctx context.Context, req *dto.ReportGenerate
|
||||
switch req.ReportType {
|
||||
case "daily":
|
||||
resp, err = service.StatReport.GenerateDailyReport(ctx, req)
|
||||
case "weekly":
|
||||
resp, err = service.StatReport.GenerateWeeklyReport(ctx, req)
|
||||
case "monthly":
|
||||
resp, err = service.StatReport.GenerateMonthlyReport(ctx, req)
|
||||
case "quarterly":
|
||||
@@ -25,7 +28,7 @@ func (c *statReport) GenerateReport(ctx context.Context, req *dto.ReportGenerate
|
||||
case "yearly":
|
||||
resp, err = service.StatReport.GenerateYearlyReport(ctx, req)
|
||||
default:
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("不支持的报表类型: %s", req.ReportType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user