From f90ad431fa73c1ac9263942739ab9002610e454f Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 24 Oct 2024 19:09:13 +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 | 2 +- src/dao/medium_dao.go | 2 +- src/implement/admin_bind_medium_implement.go | 7 ++++--- src/implement/medium_implement.go | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/dao/admin_bind_medium_dao.go b/src/dao/admin_bind_medium_dao.go index 95c66e0..f468be8 100644 --- a/src/dao/admin_bind_medium_dao.go +++ b/src/dao/admin_bind_medium_dao.go @@ -4,5 +4,5 @@ import "code.fnuoos.com/zhimeng/model.git/src/model" type AdminBindMediumDao interface { FindAll(adminId int) (list []model.AdminBindMedium) - FindMediumList(mediumId []int, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) + FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) } diff --git a/src/dao/medium_dao.go b/src/dao/medium_dao.go index c0f7d5c..f175814 100644 --- a/src/dao/medium_dao.go +++ b/src/dao/medium_dao.go @@ -15,7 +15,7 @@ type MediumDao interface { GetMedium(id int) (m *model.Medium, err error) FindMediumRolePermissionGroup(id int) (list []*MediumWithRolePermissionGroup, total int64, err error) FindSuperAdmin(username, memo string, page, limit int) (list []model.Medium, total int64, err error) - FindSuperAdminByMediumId(mediumId []int, page, limit int) (list []model.Medium, total int64, err error) + FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error) GetSuperAdmin(mediumId int) (list *model.Medium) } diff --git a/src/implement/admin_bind_medium_implement.go b/src/implement/admin_bind_medium_implement.go index e86b118..7ad0761 100644 --- a/src/implement/admin_bind_medium_implement.go +++ b/src/implement/admin_bind_medium_implement.go @@ -3,6 +3,7 @@ package implement import ( "code.fnuoos.com/zhimeng/model.git/src/dao" "code.fnuoos.com/zhimeng/model.git/src/model" + "strings" "xorm.io/xorm" ) @@ -22,10 +23,10 @@ func (a AdminBindMediumDb) FindAll(adminId int) (list []model.AdminBindMedium) { } return } -func (a AdminBindMediumDb) FindMediumList(mediumId []int, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) { +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 len(mediumId) > 0 { - sess.In("medium_id", mediumId) + if mediumId != "" { + sess.In("medium_id", strings.Split(mediumId, ",")) } total, err = sess.FindAndCount(&list) if err != nil { diff --git a/src/implement/medium_implement.go b/src/implement/medium_implement.go index bf7e1cf..d5629ac 100644 --- a/src/implement/medium_implement.go +++ b/src/implement/medium_implement.go @@ -5,6 +5,7 @@ import ( "code.fnuoos.com/zhimeng/model.git/src/model" zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" "reflect" + "strings" "xorm.io/xorm" ) @@ -112,10 +113,10 @@ func (m MediumDb) FindSuperAdmin(username, memo string, page, limit int) (list [ } return } -func (m MediumDb) FindSuperAdminByMediumId(mediumId []int, page, limit int) (list []model.Medium, total int64, err error) { +func (m MediumDb) FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error) { sess := m.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit) - if len(mediumId) > 0 { - sess.In("medium_id", mediumId) + if mediumId != "" { + sess.In("medium_id", strings.Split(mediumId, ",")) } total, err = sess.FindAndCount(&list) if err != nil {