|
@@ -84,7 +84,7 @@ func GetDepartmentByCompanyId(companyId int64) (v []*Department, err error) { |
|
@@ -84,7 +84,7 @@ func GetDepartmentByCompanyId(companyId int64) (v []*Department, err error) { |
84
|
select *
|
84
|
select *
|
85
|
from department
|
85
|
from department
|
86
|
where company_id =? and delete_at =0
|
86
|
where company_id =? and delete_at =0
|
87
|
-order by parent_id,id`
|
87
|
+order by level,id`
|
88
|
if _, err = o.Raw(sql, companyId).QueryRows(&v); err == nil {
|
88
|
if _, err = o.Raw(sql, companyId).QueryRows(&v); err == nil {
|
89
|
return
|
89
|
return
|
90
|
}
|
90
|
}
|
|
@@ -107,7 +107,7 @@ func GetDepartmentIdsByCompanyId(companyId int) (v []int64, err error) { |
|
@@ -107,7 +107,7 @@ func GetDepartmentIdsByCompanyId(companyId int) (v []int64, err error) { |
107
|
select id
|
107
|
select id
|
108
|
from department
|
108
|
from department
|
109
|
where company_id =? and delete_at =0
|
109
|
where company_id =? and delete_at =0
|
110
|
-order by parent_id,id`
|
110
|
+order by level,id`
|
111
|
if _, err = o.Raw(sql, companyId).QueryRows(&v); err == nil {
|
111
|
if _, err = o.Raw(sql, companyId).QueryRows(&v); err == nil {
|
112
|
return
|
112
|
return
|
113
|
}
|
113
|
}
|
|
@@ -122,7 +122,7 @@ select id from ( |
|
@@ -122,7 +122,7 @@ select id from ( |
122
|
select department_id from user_department where user_company_id=? and enable_status = 1
|
122
|
select department_id from user_department where user_company_id=? and enable_status = 1
|
123
|
)a inner join department b on a.department_id = b.id
|
123
|
)a inner join department b on a.department_id = b.id
|
124
|
where b.delete_at =0
|
124
|
where b.delete_at =0
|
125
|
-order by parent_id,id`
|
125
|
+order by b.level,b.id`
|
126
|
if _, err = o.Raw(sql, uid).QueryRows(&v); err == nil {
|
126
|
if _, err = o.Raw(sql, uid).QueryRows(&v); err == nil {
|
127
|
if err == orm.ErrNoRows {
|
127
|
if err == orm.ErrNoRows {
|
128
|
err = nil
|
128
|
err = nil
|