lambdaQueryWrapper多条件嵌套查询


queryWrapper.and(wq -> {
            if(!CollectionUtils.isEmpty(orgList)){
                wq.or(wq0 -> wq0.in(PatrolPlan::getOrgId, orgList));
                wq.or(wq1 -> wq1.eq(PatrolPlan::getPlanExecType, PlanExecTypeEnum.ORG.getCode()).in(PatrolPlan::getPlanExecTypeId, orgList));
            }
            wq.or(wq2 -> wq2.eq(PatrolPlan::getPlanExecType,  PlanExecTypeEnum.PERSON.getCode()).eq(PatrolPlan::getPlanExecTypeId, userId));
        });


        //业务类型
        Long typeId = data.getTypeId();
        if (Objects.nonNull(typeId)) {
            queryWrapper.eq(PatrolPlan::getTypeId, typeId);
        }
(((org_id IN (?)) OR (plan_exec_type = ? AND plan_exec_type_id IN (?)) OR (plan_exec_type = ? AND plan_exec_type_id = ?)) and type_id = ?

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM