From f120af0d8ade2cf590cc31d8ee6e5924afd96fea Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 30 Sep 2024 14:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/admin_role_dao.go | 3 ++- src/implement/admin_role_implement.go | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/dao/admin_role_dao.go b/src/dao/admin_role_dao.go index 16e9a48..e036b27 100644 --- a/src/dao/admin_role_dao.go +++ b/src/dao/admin_role_dao.go @@ -1,4 +1,4 @@ -package dao +package dao import ( "code.fnuoos.com/zhimeng/model.git/src/model" @@ -10,6 +10,7 @@ type AdminRoleDao interface { FindAdminRoleByRoleId(id int) (*[]model.AdminRole, error) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) GetAdminRoleByRole(id int) (m *model.AdminRole, err error) + GetAdminRoleByAdminId(id int) (m *model.AdminRole, err error) AdminRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) AdminRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) BatchAddAdminRoleBySession(session *xorm.Session, mm []*model.AdminRole) (int64, error) diff --git a/src/implement/admin_role_implement.go b/src/implement/admin_role_implement.go index d2b5b64..ace0de6 100644 --- a/src/implement/admin_role_implement.go +++ b/src/implement/admin_role_implement.go @@ -1,4 +1,4 @@ -package implement +package implement import ( "code.fnuoos.com/zhimeng/model.git/src/dao" @@ -51,6 +51,17 @@ func (a AdminRoleDb) GetAdminRoleByRole(id int) (m *model.AdminRole, err error) } return m, nil } +func (a AdminRoleDb) GetAdminRoleByAdminId(id int) (m *model.AdminRole, err error) { + m = new(model.AdminRole) + has, err := a.Db.Where("adm_id =?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} func (a AdminRoleDb) AdminRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { if reflect.TypeOf(roleId).Kind() == reflect.Slice {