| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package sysreport
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- model "dashoo.cn/micro/app/model/contract"
- "dashoo.cn/micro/app/model/sys_report"
- service "dashoo.cn/micro/app/service/sys_report"
- "github.com/gogf/gf/frame/g"
- )
- type SysReportHandler struct{}
- // Swagger:Report 报表,测试tag 获取报表列表
- func (c *SysReportHandler) GetList(ctx context.Context, req *sys_report.SysReportListReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("SysReportHandler.List request %#v ", *req)
- s, err := service.NewSysReportService(ctx)
- if err != nil {
- return err
- }
- total, ent, err := s.List(ctx, req)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": ent, "total": total}
- return nil
- }
- // Swagger:Report 报表,测试tag 添加数据
- func (c *SysReportHandler) Create(ctx context.Context, req *sys_report.SysReport, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("SysReportHandler.Add request %#v ", *req)
- s, err := service.NewSysReportService(ctx)
- if err != nil {
- return err
- }
- id, err := s.Add(ctx, req)
- rsp.Data = g.Map{"list": id}
- return nil
- }
- // Swagger:Report 报表,测试tag 更新数据
- func (c *SysReportHandler) UpdateById(ctx context.Context, req *sys_report.SysReport, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("SysReportHandler.Update request %#v ", *req)
- s, err := service.NewSysReportService(ctx)
- if err != nil {
- return err
- }
- id, err := s.Update(ctx, req)
- rsp.Data = g.Map{"list": id}
- return nil
- }
- // Swagger:Report 报表,测试tag 删除数据
- func (c *SysReportHandler) DeleteByIds(ctx context.Context, req *sys_report.IdsReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("SysReportHandler.Delete request %#v ", *req)
- s, err := service.NewSysReportService(ctx)
- if err != nil {
- return err
- }
- err = s.Delete(ctx, req.Id)
- if err != nil {
- return err
- }
- return nil
- }
- // Swagger:Report 报表,测试tag 数据详情
- func (c *SysReportHandler) GetEntityById(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("SysReportHandler.Get request %#v ", *req)
- s, err := service.NewSysReportService(ctx)
- if err != nil {
- return err
- }
- ent, err := s.Get(ctx, req.Id)
- if err != nil {
- return err
- }
- rsp.Data = ent
- return nil
- }
|