新增专长
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// Package controller 专长
|
||||
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/diseaseClassExpertiseResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
|
||||
type DiseaseClassExpertise struct{}
|
||||
|
||||
// GetExpertiseList 获取专长列表
|
||||
func (b *DiseaseClassExpertise) GetExpertiseList(c *gin.Context) {
|
||||
expertiseRequest := requests.ExpertiseRequest{}
|
||||
if err := c.ShouldBind(&expertiseRequest.GetExpertiseList); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(expertiseRequest.GetExpertiseList); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
diseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||
|
||||
diseaseClassExpertises, err := diseaseClassExpertiseDao.GetDiseaseClassExpertiseListByMaps(expertiseRequest.GetExpertiseList)
|
||||
if err != nil {
|
||||
responses.Ok(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getDepartmentListResponse := diseaseClassExpertiseResponse.GetDiseaseClassExpertiseListResponse(diseaseClassExpertises)
|
||||
responses.OkWithData(getDepartmentListResponse, c)
|
||||
}
|
||||
Reference in New Issue
Block a user