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 = ?
标签:lambdaQueryWrapper,PatrolPlan,exec,type,查询,嵌套,plan,eq,id 来源: https://www.cnblogs.com/xiadongqing/p/15507749.html