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