新增部门列表
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
//获取列表
|
||||
func (d *LdapDepartmentModel)GetList(ctx context.Context,page,limit int,sort string)(resp []LdapDepartment,total int64,err error){
|
||||
func (d *LdapDepartmentModel)GetAll(ctx context.Context,sort string)(resp []LdapDepartment,total int64,err error){
|
||||
db := d.db.WithContext(ctx).Model(&LdapDepartment{})
|
||||
if sort != ""{
|
||||
db = db.Order(sort)
|
||||
@@ -15,8 +15,7 @@ func (d *LdapDepartmentModel)GetList(ctx context.Context,page,limit int,sort str
|
||||
if err = db.Count(&total).Error;err != nil{
|
||||
return nil, 0, err
|
||||
}
|
||||
offset := (page - 1) * limit
|
||||
err = db.Offset(offset).Limit(limit).Find(&resp).Error
|
||||
err = db.Find(&resp).Error
|
||||
return resp, total, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user