package contract import ( "context" model "dashoo.cn/micro/app/model/contract" service "dashoo.cn/micro/app/service/contract" "dashoo.cn/common_definition/comm_def" "github.com/gogf/gf/frame/g" ) type CtrContractInvoice struct{} // Swagger:CtrContractInvoice 合同发票 查询合同发票 func (c *CtrContractInvoice) List(ctx context.Context, req *model.CtrContractInvoiceListReq, rsp *comm_def.CommonMsg) error { g.Log().Infof("CtrContractInvoice.List request %#v ", *req) s, err := service.NewCtrContractInvoiceService(ctx) if err != nil { return err } total, ent, err := s.List(ctx, req) //_, err, code, msg := myerrors.CheckError(err) if err != nil { return err } if ent == nil { ent = []*model.CtrContractInvoice{} } //rsp.Code = code //rsp.Msg = msg rsp.Data = map[string]interface{}{ "total": total, "list": ent, } return nil } // Swagger:CtrContractInvoice 合同发票 添加合同发票 func (c *CtrContractInvoice) Add(ctx context.Context, req *model.CtrContractInvoiceAddReq, rsp *comm_def.CommonMsg) error { g.Log().Infof("CtrContractInvoice.Add request %#v ", *req) s, err := service.NewCtrContractInvoiceService(ctx) if err != nil { return err } id, err := s.Add(ctx, req) //_, err, code, msg := myerrors.CheckError(err) if err != nil { return err } //rsp.Code = code //rsp.Msg = msg rsp.Data = id return nil } // Swagger:CtrContractInvoice 合同发票 更新合同发票 func (c *CtrContractInvoice) Update(ctx context.Context, req *model.CtrContractInvoiceUpdateReq, rsp *comm_def.CommonMsg) error { g.Log().Infof("CtrContractInvoice.Update request %#v ", *req) s, err := service.NewCtrContractInvoiceService(ctx) if err != nil { return err } err = s.Update(ctx, req) if err != nil { return err } return nil } // Swagger:CtrContractInvoice 合同发票 提交发票申请 func (c *CtrContractInvoice) InvoiceApply(ctx context.Context, req *model.CtrContractInvoiceInvoiceApplyReq, rsp *comm_def.CommonMsg) error { g.Log().Infof("CtrContractInvoice.InvoiceApply request %#v ", *req) s, err := service.NewCtrContractInvoiceService(ctx) if err != nil { return err } err = s.InvoiceApply(ctx, req) if err != nil { return err } return nil } // Swagger:CtrContractInvoice 合同发票 删除合同发票 func (c *CtrContractInvoice) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error { g.Log().Infof("CtrContractInvoice.Delete request %#v ", *req) s, err := service.NewCtrContractInvoiceService(ctx) if err != nil { return err } err = s.Delete(ctx, req.Id) if err != nil { return err } return nil }