是的,根据前端传递的过滤条件,可以判断这三个属性是否有值,然后将它们拼接到wrapper中,再使用page方法进行查询。以下是一个可能的实现示例:

public R getmaintenancePlanRecordPage(Page page, MaintenancePlanRecordEntity maintenancePlanRecord) {
    LambdaQueryWrapper<MaintenancePlanRecordEntity> wrapper = Wrappers.lambdaQuery();
    
    // 判断createTime是否有值,如果有则添加到查询条件中
    if (maintenancePlanRecord.getCreateTime() != null) {
        wrapper.eq(MaintenancePlanRecordEntity::getCreateTime, maintenancePlanRecord.getCreateTime());
    }
    
    // 判断customerId是否有值,如果有则添加到查询条件中
    if (maintenancePlanRecord.getCustomerId() != null) {
        wrapper.eq(MaintenancePlanRecordEntity::getCustomerId, maintenancePlanRecord.getCustomerId());
    }
    
    // 判断planId是否有值,如果有则添加到查询条件中
    if (maintenancePlanRecord.getPlanId() != null) {
        wrapper.eq(MaintenancePlanRecordEntity::getPlanId, maintenancePlanRecord.getPlanId());
    }
    
    return R.ok(maintenancePlanRecordService.page(page, wrapper));
}

这样就可以根据前端传递的过滤条件进行查询了


原文地址: https://www.cveoy.top/t/topic/iw7a 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录