supplier_invoice_list.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "youngee_b_api/model/http_model"
  5. "youngee_b_api/service"
  6. )
  7. func WrapSupplierInvoiceListHandler(ctx *gin.Context) {
  8. handler := newSupplierInvoiceListHandler(ctx)
  9. baseRun(handler)
  10. }
  11. func newSupplierInvoiceListHandler(ctx *gin.Context) *SupplierInvoiceListHandler {
  12. return &SupplierInvoiceListHandler{
  13. req: http_model.NewSupplierInvoiceListRequest(),
  14. resp: http_model.NewSupplierInvoiceListResponse(),
  15. ctx: ctx,
  16. }
  17. }
  18. type SupplierInvoiceListHandler struct {
  19. req *http_model.SupplierInvoiceListRequest
  20. resp *http_model.CommonResponse
  21. ctx *gin.Context
  22. }
  23. func (h *SupplierInvoiceListHandler) getRequest() interface{} {
  24. return h.req
  25. }
  26. func (h *SupplierInvoiceListHandler) getContext() *gin.Context {
  27. return h.ctx
  28. }
  29. func (h *SupplierInvoiceListHandler) getResponse() interface{} {
  30. return h.resp
  31. }
  32. func (h *SupplierInvoiceListHandler) run() {
  33. supplierInvoice, err := service.Supplier.GetSupplierInvoiceList(h.ctx, h.req)
  34. if err != nil {
  35. h.resp.Data = err
  36. h.resp.Message = "查询失败"
  37. }
  38. h.resp.Data = supplierInvoice
  39. h.resp.Message = "查询成功"
  40. }
  41. func (h *SupplierInvoiceListHandler) checkParam() error {
  42. return nil
  43. }