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 {