新增部门列表

This commit is contained in:
laodaming
2023-11-14 11:26:08 +08:00
parent 561ce385a1
commit 15671c02c3
7 changed files with 55 additions and 62 deletions

View File

@@ -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
}