新增菜单详情
This commit is contained in:
parent
d0f9eaea61
commit
6e6e3803e4
@ -2,6 +2,7 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
"hospital-admin-api/api/service"
|
"hospital-admin-api/api/service"
|
||||||
@ -170,3 +171,29 @@ func (r *Menu) DeleteMenu(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
responses.Ok(c)
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ type AdminUser struct {
|
|||||||
Avatar string `gorm:"column:avatar;type:varchar(255);comment:'头像'" json:"avatar"`
|
Avatar string `gorm:"column:avatar;type:varchar(255);comment:'头像'" json:"avatar"`
|
||||||
Sex int `gorm:"column:sex;type:tinyint(1);comment:'性别(1:男 2:女)'" json:"sex"`
|
Sex int `gorm:"column:sex;type:tinyint(1);comment:'性别(1:男 2:女)'" json:"sex"`
|
||||||
Email string `gorm:"column:email;type:varchar(100);comment:'邮箱'" json:"email"`
|
Email string `gorm:"column:email;type:varchar(100);comment:'邮箱'" json:"email"`
|
||||||
RoleID int64 `gorm:"column:role_id;type:bigint(19);comment:'角色表'" json:"role_id"`
|
RoleID int64 `gorm:"column:role_id;type:bigint(19);comment:'角色id'" json:"role_id"`
|
||||||
DeptID int64 `gorm:"column:dept_id;type:bigint(19);comment:'部门id'" json:"dept_id"`
|
DeptID int64 `gorm:"column:dept_id;type:bigint(19);comment:'部门id'" json:"dept_id"`
|
||||||
PostID int64 `gorm:"column:post_id;type:bigint(19);comment:'岗位id'" json:"post_id"`
|
PostID int64 `gorm:"column:post_id;type:bigint(19);comment:'岗位id'" json:"post_id"`
|
||||||
Role *AdminRole `gorm:"foreignKey:RoleID"` // 角色
|
Role *AdminRole `gorm:"foreignKey:RoleID"` // 角色
|
||||||
|
|||||||
@ -108,6 +108,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
|
|
||||||
// 删除菜单-批量
|
// 删除菜单-批量
|
||||||
menuGroup.DELETE("", api.Menu.DeleteMenu)
|
menuGroup.DELETE("", api.Menu.DeleteMenu)
|
||||||
|
|
||||||
|
// 菜单详情
|
||||||
|
menuGroup.GET("/:menu_id", api.Menu.GetMenu)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户
|
// 用户
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user