From 2e4363a7d4d2093e75b9150a7bb69ff6b03bd811 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 31 Oct 2023 13:08:36 +0800 Subject: [PATCH] 1 --- api/controller/doctorWithdrawal.go | 41 ++++++++++++++++++++++++++++++ api/dao/doctorWithdrawalOrder.go | 27 ++++++++++++++++++++ api/router/router.go | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 api/dao/doctorWithdrawalOrder.go diff --git a/api/controller/doctorWithdrawal.go b/api/controller/doctorWithdrawal.go index 2b01f59..c6eabed 100644 --- a/api/controller/doctorWithdrawal.go +++ b/api/controller/doctorWithdrawal.go @@ -81,3 +81,44 @@ func (r *DoctorWithdrawal) GetDoctorWithdrawal(c *gin.Context) { responses.OkWithData(res, c) } + +// GetDoctorWithdrawalOrderPage 提现详情-关联订单列表-分页 +func (r *DoctorWithdrawal) GetDoctorWithdrawalOrderPage(c *gin.Context) { + doctorWithdrawalRequest := requests.DoctorWithdrawalRequest{} + req := doctorWithdrawalRequest.GetDoctorWithdrawalPage + if err := c.ShouldBind(&req); err != nil { + responses.FailWithMessage(err.Error(), c) + return + } + + // 参数验证 + if err := global.Validate.Struct(req); err != nil { + responses.FailWithMessage(utils.Translate(err), c) + return + } + + if req.Page == 0 { + req.Page = 1 + } + + if req.PageSize == 0 { + req.PageSize = 20 + } + + doctorWithdrawalDao := dao.DoctorWithdrawalDao{} + doctorWithdrawal, total, err := doctorWithdrawalDao.GetDoctorWithdrawalPageSearch(req, req.Page, req.PageSize) + if err != nil { + responses.FailWithMessage(err.Error(), c) + return + } + + // 处理返回值 + res := dto.GetDoctorWithdrawalListDto(doctorWithdrawal) + + result := make(map[string]interface{}) + result["page"] = req.Page + result["page_size"] = req.PageSize + result["total"] = total + result["data"] = res + responses.OkWithData(result, c) +} diff --git a/api/dao/doctorWithdrawalOrder.go b/api/dao/doctorWithdrawalOrder.go new file mode 100644 index 0000000..8b8c063 --- /dev/null +++ b/api/dao/doctorWithdrawalOrder.go @@ -0,0 +1,27 @@ +package dao + +import ( + "hospital-admin-api/api/model" + "hospital-admin-api/global" +) + +type DoctorWithdrawalOrderDao struct { +} + +// GetDoctorWithdrawalOrderById 获取医生提现关联订单数据-id +func (r *DoctorWithdrawalBankDao) GetDoctorWithdrawalOrderById(withdrawalBankId int64) (m *model.DoctorWithdrawalBank, err error) { + err = global.Db.First(&m, withdrawalBankId).Error + if err != nil { + return nil, err + } + return m, nil +} + +// GetDoctorWithdrawalOrderByWithdrawalId 获取医生提现关联订单数据-提现id +func (r *DoctorWithdrawalBankDao) GetDoctorWithdrawalOrderByWithdrawalId(withdrawalId int64) (m *model.DoctorWithdrawalBank, err error) { + err = global.Db.Where("withdrawal_id = ?", withdrawalId).First(&m).Error + if err != nil { + return nil, err + } + return m, nil +} diff --git a/api/router/router.go b/api/router/router.go index a802ff2..7e1fb16 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -518,7 +518,7 @@ func privateRouter(r *gin.Engine, api controller.Api) { withdrawalGroup.GET("/:withdrawal_id", api.DoctorWithdrawal.GetDoctorWithdrawal) // 提现详情-关联订单列表-分页 - withdrawalGroup.GET("/order/:withdrawal_id", api.OrderPrescription.GetOrderPrescriptionPage) + withdrawalGroup.GET("/order/:withdrawal_id", api.DoctorWithdrawal.GetDoctorWithdrawalOrderPage) // 修改提现个人所得税 withdrawalGroup.PUT("/income/:withdrawal_id", api.OrderPrescription.GetOrderPrescriptionPage)