Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.jeecg.modules.system.service.impl.SysDepartServiceImpl.searh 逻辑异常 #3311

Closed
xinwu-yang opened this issue Dec 24, 2021 · 2 comments

Comments

@xinwu-yang
Copy link

xinwu-yang commented Dec 24, 2021

版本号:

2.4.3

问题描述:

首先searh单词写错了哈。
当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效!

截图&代码:
//myDeptSearch不为空时为我的部门搜索,只搜索所负责部门
if (!StringUtil.isNullOrEmpty(myDeptSearch)) {
    //departIds 为空普通用户或没有管理部门
    if (StringUtil.isNullOrEmpty(departIds)) {
        return newList;
    }
    //根据部门id获取所负责部门
    String[] codeArr = this.getMyDeptParentOrgCode(departIds);
    if (codeArr != null) {
        for (String s : codeArr) {
            // 这里逻辑应属于优先or逻辑
            query.or().likeRight(SysDepart::getOrgCode, s);
        }
    }
    query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
}

修改为:

if (codeArr != null && codeArr.length > 0) {
    // fix 通过nested限定or范围
    query.nested(i -> {
        for (String s : codeArr) {
            i.or().likeRight(SysDepart::getOrgCode, s);
        }
    });
}

友情提示(为了提高issue处理效率):

  • 未按格式要求发帖,会被直接删掉;
  • 请自己初判问题描述是否清楚,是否方便我们调查处理;
  • 针对问题请说明是Online在线功能(需说明用的主题模板),还是生成的代码功能;
  • 描述过于简单或模糊,导致无法处理的,会被直接删掉;
@xinwu-yang xinwu-yang changed the title org.jeecg.modules.system.service.impl.SysDepartServiceImpl.searh逻辑异常 org.jeecg.modules.system.service.impl.SysDepartServiceImpl.searh 逻辑异常 Dec 24, 2021
@zhangdaiscott
Copy link
Member

ty

@tygithub1
Copy link

已修改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants