|
@@ -16,6 +16,7 @@ import java.util.Set;
|
|
|
import java.util.StringJoiner;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.entity.TenantInfo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -43,6 +44,8 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
|
|
|
@Autowired
|
|
|
private OrganizationDao organizationDao;
|
|
|
@Autowired
|
|
|
+ private TenantInfoDao tenantInfoDao;
|
|
|
+ @Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
@@ -243,13 +246,17 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
|
|
|
|
|
|
@Override
|
|
|
public String getEmployeeOrgan(Integer userId, String organIds,Boolean isSuper) {
|
|
|
- if(isSuper){
|
|
|
- Map<String,Object> param = new HashMap<>();
|
|
|
+ if(StringUtils.isEmpty(organIds)){
|
|
|
Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
- param.put("tenantId",tenantId);
|
|
|
- List<Organization> all = this.findAll(param);
|
|
|
- if(all != null && all.size() > 0){
|
|
|
- organIds = StringUtils.join(all.stream().map(e->e.getId()).collect(Collectors.toSet()),",");
|
|
|
+ TenantInfo tenantInfo = tenantInfoDao.selectById(tenantId);
|
|
|
+ //如果是超管,或者是机构管理员,可以查看当前机构所有分部数据
|
|
|
+ if(isSuper || (tenantInfo.getUserId() != null && tenantInfo.getUserId().equals(userId))){
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("tenantId",tenantId);
|
|
|
+ List<Organization> all = this.findAll(param);
|
|
|
+ if(all != null && all.size() > 0){
|
|
|
+ organIds = StringUtils.join(all.stream().map(e->e.getId()).collect(Collectors.toSet()),",");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isEmpty(organIds)){
|