作者 tangxvhui

bug 修复

... ... @@ -197,6 +197,9 @@ func GetDepartmentByCompanyId(companyId int64) ([]Department, error) {
}
func GetDepartmentByIds(departmentIds []int64) ([]Department, error) {
if len(departmentIds) == 0 {
return nil, nil
}
var (
result []Department
err error
... ...
... ... @@ -84,6 +84,9 @@ func GetUserCompanyById(id int64) (v *UserCompany, err error) {
}
func GetUserCompanyByIds(ids []int64) (v []UserCompany, err error) {
if len(ids) == 0 {
return nil, nil
}
o := orm.NewOrm()
_, err = o.QueryTable(&UserCompany{}).
Filter("id__in", ids).
... ...
... ... @@ -189,13 +189,13 @@ func SelectCompanyUserList(pageIndex int, pageSize int, companyid int64, userNam
LEFT JOIN user_department AS b ON a.id = b.user_company_id AND b.enable_status=1
LEFT JOIN department AS c ON b.department_id = c.id
LEFT JOIN user AS d ON a.user_id = d.id
WHERE a.delete_at = 0 AND c.company_id = ? `
WHERE a.delete_at = 0 AND a.enable=1 AND c.company_id = ? `
countsql := `SELECT count(*)
FROM user_company AS a
LEFT JOIN user_department AS b ON a.id = b.user_company_id AND b.enable_status=1
LEFT JOIN department AS c ON b.department_id = c.id
LEFT JOIN user AS d ON a.user_id = d.id
WHERE a.delete_at = 0 AND c.company_id =? `
WHERE a.delete_at = 0 AND a.enable=1 AND c.company_id =? `
cond := []interface{}{companyid}
where := ""
if len(userName) > 0 {
... ...
... ... @@ -228,10 +228,11 @@ func AddDepartmentData(data []ModuleDeparmentData) error {
o.Begin()
for _, v := range data {
departmentData := &models.Department{
Id: v.Id,
CompanyId: companyData.Id,
Name: v.Name,
Manages: "[]",
Id: v.Id,
CompanyId: companyData.Id,
Name: v.Name,
Manages: "[]",
BusinessDepartmentId: v.Id,
}
if v.ParentId > 0 {
parentDepart := &models.Department{}
... ...