diff --git a/src/dao/admin_bind_medium_dao.go b/src/dao/admin_bind_medium_dao.go index f468be8..191cb46 100644 --- a/src/dao/admin_bind_medium_dao.go +++ b/src/dao/admin_bind_medium_dao.go @@ -5,4 +5,5 @@ import "code.fnuoos.com/zhimeng/model.git/src/model" type AdminBindMediumDao interface { FindAll(adminId int) (list []model.AdminBindMedium) FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) + GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium) } diff --git a/src/implement/admin_bind_medium_implement.go b/src/implement/admin_bind_medium_implement.go index 7ad0761..fe70bca 100644 --- a/src/implement/admin_bind_medium_implement.go +++ b/src/implement/admin_bind_medium_implement.go @@ -23,6 +23,14 @@ func (a AdminBindMediumDb) FindAll(adminId int) (list []model.AdminBindMedium) { } return } +func (a AdminBindMediumDb) GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium) { + sess := a.Db.Where("medium_id=? and admin_id=?", mediumId, adminId) + get, err := sess.Get(&list) + if get == false || err != nil { + return nil + } + return +} func (a AdminBindMediumDb) FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) { sess := a.Db.Where("admin_id=?", adminId).Desc("id").Limit(limit, (page-1)*limit) if mediumId != "" {