Commit 29924daf authored by nie'hong's avatar nie'hong

修改-查询学习内容下级可查看上级创建的内容

parent c1888a5c
......@@ -303,13 +303,26 @@ public class LearningContentController extends BaseController {
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
// 分页查询这里不包括主学习内容
queryWrapper.eq(LearningContent::getIsMajor, false);
// 上级机构
List<String> curUserParOrgIds = getCurUserParOrgIds();
// 下级机构展板
List<String> curUserSubOrgIds = getCurUserSubOrgIds();
if (!CollectionUtils.isEmpty(curUserSubOrgIds)){
List<String> list = Arrays.asList("ALL_PLAT");
queryWrapper.and(s -> s.in(LearningContent::getOrganCode, curUserSubOrgIds).or()
.in(LearningContent::getApplicableScope, list));
}
queryWrapper.and(s -> {
if (CollectionUtil.isEmpty(curUserParOrgIds)){
s.in(LearningContent::getOrganCode, curUserSubOrgIds)
.or().in(LearningContent::getApplicableScope, list);
}else{
s.in(LearningContent::getOrganCode, curUserSubOrgIds)
.or().in(LearningContent::getApplicableScope, list)
.or(q ->q.in(LearningContent::getOrganCode, curUserParOrgIds)
.eq(LearningContent::getApplicableScope,"THIS_ORGAN_SUB"));
}
});
}
// 根据创建时间区间检索
if (genericPageParam.getIsPublished() != null) {
......@@ -373,6 +386,28 @@ public class LearningContentController extends BaseController {
return getResult(page);
}
/**
* 获取当前用户的上级机构
*/
public List<String> getCurUserParOrgIds() {
TUser tUser = getcurUser();
// 上级机构
List<String> parGranCode = new ArrayList<>();
String orgId = tUser.getOrgId();
TOrgan tOrgan = this.organService.getById(orgId);
if (!"0".equals(tOrgan.getParentId())) {
TOrgan tOrgan1 = this.organService.getById(tOrgan.getParentId());
parGranCode.add(tOrgan1.getCode());
if (!"0".equals(tOrgan1.getParentId())) {
TOrgan tOrgan2 = this.organService.getById(tOrgan1.getParentId());
parGranCode.add(tOrgan2.getCode());
}
}
return parGranCode;
}
/**
* 获取当前用户的所有子机构
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment