新增银行列表
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses"
|
||||
"hospital-admin-api/api/responses/basicBankResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type Bank struct{}
|
||||
|
||||
// GetBankList 获取银行列表
|
||||
func (b *Bank) GetBankList(c *gin.Context) {
|
||||
bankRequest := requests.BankRequest{}
|
||||
if err := c.ShouldBind(&bankRequest.GetBankList); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(bankRequest.GetBankList); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
basicBankDao := dao.BasicBankDao{}
|
||||
|
||||
basicBank, err := basicBankDao.GetBasicBankListByStruct(bankRequest.GetBankList)
|
||||
if err != nil {
|
||||
responses.Ok(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getBasicBankListResponse := basicBankResponse.GetBasicBankListResponse(basicBank)
|
||||
responses.OkWithData(getBasicBankListResponse, c)
|
||||
}
|
||||
@@ -28,4 +28,5 @@ type basic struct {
|
||||
Department // 科室管理
|
||||
Hospital // 医院管理
|
||||
DiseaseClassExpertise // 专长管理
|
||||
Bank // 银行管理
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@ func (b *DiseaseClassExpertise) GetExpertiseList(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getDepartmentListResponse := diseaseClassExpertiseResponse.GetDiseaseClassExpertiseListResponse(diseaseClassExpertises)
|
||||
responses.OkWithData(getDepartmentListResponse, c)
|
||||
getExpertiseListResponse := diseaseClassExpertiseResponse.GetDiseaseClassExpertiseListResponse(diseaseClassExpertises)
|
||||
responses.OkWithData(getExpertiseListResponse, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user