jeudi 12 septembre 2019

How to use the boolean value from a checkbox that I got the front end , in order to filter alerts with spring boot

I m new in spring boot 1.5 and i m trying to filter alerts with specific filters chosen by the client, but the problem is how to include in my code if he 's checked the checkbox or not , but in the other side (front en ) i m receiving a boolean value from the front end Boolean lateAlert

LocalDateTime late = now.minusDays(10); Specification lateAlerts = where(AlertSpec.statusIn(Arrays.asList(AlertStatus.OPEN))).and( AlertSpec.startDateEqual(late)

    );

    //create query
    Page<Alert> alerts = alertRepository.findAll(
            where(AlertSpec.notDropped())
                    .and(AlertSpec.authorLike(filter.getAddedBy()))
                    .and(AlertSpec.assignedTo(filter.getAssignee()))
                    .and(AlertSpec.statusIn(filter.getStatus()))
                    .and(AlertSpec.categoryLike(filter.getCategory()))
                    .and(AlertSpec.subcategoryLike(filter.getSubCategory()))
                    .and(AlertSpec.countryLike(filter.getCountry()))
                    .and(AlertSpec.addedBetween(filter.getStartDate(), filter.getEndDate()))
                    .and((where(AlertSpec.statusIn(Arrays.asList(AlertStatus.OPEN))).and(
                            AlertSpec.startDateEqual(late))))
            , pageRequest);




Aucun commentaire:

Enregistrer un commentaire