作者 唐旭辉

bug 修复

... ... @@ -6,7 +6,6 @@ import (
"oppmg/models"
"oppmg/protocol"
"oppmg/utils"
"strings"
"time"
)
... ... @@ -334,21 +333,16 @@ func GetRoleHasRole(roleid int64, companyid int64) ([]protocol.RoleHasUser, erro
return roleuserlist, protocol.NewErrWithMessage("1")
}
var (
ucid []string
datasql string = `SELECT user_company_id FROM user_role
WHERE company_id=? AND role_id =? AND enable_status = 1`
datasql2 string = `SELECT a.nick_name,b.id AS user_company_id FROM user AS a,user_company AS b
WHERE a.id= b.user_id AND b.id IN(%s)`
datasql2 string = `SELECT a.nick_name,b.id AS user_company_id
FROM user AS a
JOIN user_company AS b ON a.id=b.user_id
JOIN user_role AS c ON b.id= c.user_company_id
WHERE c.company_id=?
AND c.role_id =?
AND c.enable_status = 1
AND b.enable = 1 AND b.delete_at = 0 `
)
err = utils.ExecuteQueryAll(&ucid, datasql, companyid, roleid)
if err != nil {
log.Error("获取用户id失败:%s", err)
return roleuserlist, protocol.NewErrWithMessage("1")
}
if len(ucid) == 0 {
return roleuserlist, nil
}
err = utils.ExecuteQueryAll(&roleuserlist, fmt.Sprintf(datasql2, strings.Join(ucid, ",")))
err = utils.ExecuteQueryAll(&roleuserlist, datasql2, companyid, roleid)
if err != nil {
log.Error("获取用户数据失败;%s", err)
}
... ...