@@ -4,5 +4,5 @@ import "code.fnuoos.com/zhimeng/model.git/src/model" | |||||
type AdminBindMediumDao interface { | type AdminBindMediumDao interface { | ||||
FindAll(adminId int) (list []model.AdminBindMedium) | 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) | |||||
} | } |
@@ -15,7 +15,7 @@ type MediumDao interface { | |||||
GetMedium(id int) (m *model.Medium, err error) | GetMedium(id int) (m *model.Medium, err error) | ||||
FindMediumRolePermissionGroup(id int) (list []*MediumWithRolePermissionGroup, total int64, 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) | 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) | GetSuperAdmin(mediumId int) (list *model.Medium) | ||||
} | } | ||||
@@ -3,6 +3,7 @@ package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/dao" | "code.fnuoos.com/zhimeng/model.git/src/dao" | ||||
"code.fnuoos.com/zhimeng/model.git/src/model" | "code.fnuoos.com/zhimeng/model.git/src/model" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -22,10 +23,10 @@ func (a AdminBindMediumDb) FindAll(adminId int) (list []model.AdminBindMedium) { | |||||
} | } | ||||
return | 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) | 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) | total, err = sess.FindAndCount(&list) | ||||
if err != nil { | if err != nil { | ||||
@@ -5,6 +5,7 @@ import ( | |||||
"code.fnuoos.com/zhimeng/model.git/src/model" | "code.fnuoos.com/zhimeng/model.git/src/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"reflect" | "reflect" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -112,10 +113,10 @@ func (m MediumDb) FindSuperAdmin(username, memo string, page, limit int) (list [ | |||||
} | } | ||||
return | 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) | 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) | total, err = sess.FindAndCount(&list) | ||||
if err != nil { | if err != nil { | ||||