新增菜单详情
This commit is contained in:
@@ -2,6 +2,7 @@ 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/service"
|
||||
@@ -170,3 +171,29 @@ func (r *Menu) DeleteMenu(c *gin.Context) {
|
||||
}
|
||||
responses.Ok(c)
|
||||
}
|
||||
|
||||
// GetMenu 菜单详情
|
||||
func (r *Menu) GetMenu(c *gin.Context) {
|
||||
id := c.Param("menu_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
menuId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
AdminMenuDao := dao.AdminMenuDao{}
|
||||
|
||||
adminMenu, _ := AdminMenuDao.GetAdminMenuById(menuId)
|
||||
if adminMenu == nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(adminMenu, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user