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 = ?

  

posted @ 2021-11-04 13:24  夏冬青  阅读(5092)  评论(0编辑  收藏  举报