修改角色
This commit is contained in:
parent
2cf45830ff
commit
f391667879
@ -187,14 +187,19 @@ func (r *Role) GetRole(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 获取角色身份
|
||||
roleService := service.RoleService{}
|
||||
isAdmin, err := roleService.GetRoleIden(c)
|
||||
if err != nil {
|
||||
// 获取角色数据
|
||||
adminRoleDao := dao.AdminRoleDao{}
|
||||
adminRole, err := adminRoleDao.GetAdminRoleFirstById(roleId)
|
||||
if err != nil || adminRole == nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
isAdmin := false
|
||||
if adminRole.IsAdmin == 1 {
|
||||
isAdmin = true
|
||||
}
|
||||
|
||||
RoleService := service.RoleService{}
|
||||
adminRole, menuIds, err := RoleService.GetRole(roleId, isAdmin)
|
||||
if err != nil {
|
||||
|
||||
@ -3,10 +3,8 @@ 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/hosDepCustomResponse"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
)
|
||||
@ -27,16 +25,7 @@ func (b *Department) GetDepartmentCustomList(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomList(maps)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getDepartmentListResponse := hosDepCustomResponse.GetHospitalDepartmentCustomListResponse(hospitalDepartmentCustom)
|
||||
responses.OkWithData(getDepartmentListResponse, c)
|
||||
// getDepartmentListResponse := hosDepCustomResponse.GetHospitalDepartmentCustomListResponse(hospitalDepartmentCustom)
|
||||
// responses.OkWithData(getDepartmentListResponse, c)
|
||||
}
|
||||
|
||||
17
api/service/department.go
Normal file
17
api/service/department.go
Normal file
@ -0,0 +1,17 @@
|
||||
package service
|
||||
|
||||
type DepartmentService struct{}
|
||||
|
||||
// // GetDepartmentCustomList 获取自定义科室列表
|
||||
// func (r *DepartmentService) GetDepartmentCustomList(departmentRequest requests.GetDepartmentCustomList) (bool, error) {
|
||||
// hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{}
|
||||
//
|
||||
// maps := make(map[string]interface{})
|
||||
// if departmentRequest.DepartmentId != "" {
|
||||
// maps["department_id"] = departmentRequest.DepartmentId
|
||||
// }
|
||||
// hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomList(maps)
|
||||
// if err != nil {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
Loading…
x
Reference in New Issue
Block a user