...
|
...
|
@@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error { |
|
|
return err
|
|
|
}
|
|
|
|
|
|
func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) ([]*domain.RoleContainUser, error) {
|
|
|
func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) (int64, []*domain.RoleContainUser, error) {
|
|
|
limit := pageSize
|
|
|
offset := limit * (pageNumber - 1)
|
|
|
if offset < 0 {
|
...
|
...
|
@@ -210,9 +210,15 @@ func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, |
|
|
}
|
|
|
dataSql += whereFrom
|
|
|
dataSql = fmt.Sprintf("%s limit %d offset %d", dataSql, limit, offset)
|
|
|
countSql := ` SELECT COUNT(*) ` + whereFrom
|
|
|
|
|
|
tx := repo.transactionContext.PgTx
|
|
|
|
|
|
var total int64
|
|
|
var dataList = make([]*domain.RoleContainUser, 0)
|
|
|
_, err := tx.Query(&dataList, dataSql, param...)
|
|
|
return dataList, err
|
|
|
|
|
|
// 获取总数量
|
|
|
_, _ = tx.QueryOne(pg.Scan(&total), countSql, param...)
|
|
|
return total, dataList, err
|
|
|
} |
...
|
...
|
|