@@ -15,6 +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) | |||||
GetSuperAdmin(mediumId int) (list *model.Medium) | GetSuperAdmin(mediumId int) (list *model.Medium) | ||||
} | } | ||||
@@ -112,6 +112,17 @@ 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) { | |||||
sess := m.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit) | |||||
if len(mediumId) > 0 { | |||||
sess.In("medium_id", mediumId) | |||||
} | |||||
total, err = sess.FindAndCount(&list) | |||||
if err != nil { | |||||
return nil, 0, err | |||||
} | |||||
return | |||||
} | |||||
func (m MediumDb) GetSuperAdmin(mediumId int) (list *model.Medium) { | func (m MediumDb) GetSuperAdmin(mediumId int) (list *model.Medium) { | ||||
list = new(model.Medium) | list = new(model.Medium) | ||||
sess := m.Db.Where("is_super_administrator=1 and medium_id=?", mediumId) | sess := m.Db.Where("is_super_administrator=1 and medium_id=?", mediumId) | ||||