|
@@ -378,15 +378,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
}
|
|
|
//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
|
|
|
userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
|
|
|
- if userEnt.Role_admin_department { //部门管理员 获取所有子部门
|
|
|
- var deptIds []string
|
|
|
- r := IC.MainMysql.SelectBySql(`select DISTINCT b.* from entniche_department_parent a
|
|
|
- INNER JOIN entniche_department b on (b.ent_id=? and (b.id=? or (a.pid=? and a.id=b.id)))`, spqp.EntId, userEnt.Dept.Id, userEnt.Dept.Id)
|
|
|
- if r != nil && len(*r) > 0 {
|
|
|
- for _, v := range *r {
|
|
|
- deptIds = append(deptIds, common.InterfaceToStr(v["id"]))
|
|
|
+ if userEnt.Role_admin_department { //部门管理员 获取所有部门和子部门员工
|
|
|
+ users := GetDisUsers(common.IntAll(spqp.EntId), userEnt.Dept.Id)
|
|
|
+ var userIds []string
|
|
|
+ if users != nil && len(*users) > 0 {
|
|
|
+ for _, v := range *users {
|
|
|
+ userIds = append(userIds, common.InterfaceToStr(v.Id))
|
|
|
}
|
|
|
- userStr += fmt.Sprintf(" a.deptid in (%s) ", strings.Join(deptIds, ","))
|
|
|
+ userStr += fmt.Sprintf(" a.userid in (%s) ", strings.Join(userIds, ","))
|
|
|
}
|
|
|
}
|
|
|
} else {
|