From 5f350a1a0c097b7aac398783584e8d3a3234711e Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 24 Oct 2024 19:33:02 +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_bind_medium_dao.go | 1 + src/implement/admin_bind_medium_implement.go | 8 ++++++++ 2 files changed, 9 insertions(+) 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 != "" {