diff --git a/src/main/java/app/controllers/user/PublicController.java b/src/main/java/app/controllers/user/PublicController.java index aa23aa1..e9327e8 100644 --- a/src/main/java/app/controllers/user/PublicController.java +++ b/src/main/java/app/controllers/user/PublicController.java @@ -68,6 +68,7 @@ public class PublicController { banSearchFilter.getAccounts(profileService), banSearchFilter.getBeginTimestamp(), banSearchFilter.getEndTimestamp(), + banSearchFilter.getActiveObj(), banSearchFilter.getActive(), banSearchFilter.getAdminIds(profileService)) , HttpStatus.OK); diff --git a/src/main/java/app/entities/db/ban/BanSearchFilter.java b/src/main/java/app/entities/db/ban/BanSearchFilter.java index f3ac78f..93e8417 100644 --- a/src/main/java/app/entities/db/ban/BanSearchFilter.java +++ b/src/main/java/app/entities/db/ban/BanSearchFilter.java @@ -18,10 +18,14 @@ public class BanSearchFilter extends SearchFilter { return ban_ids == null || ban_ids.isEmpty() ? null : ban_ids; } - public Boolean getActive() { + public boolean getActive() { return active; } + public Integer getActiveObj() { + return active == null?null:1; + } + public List getAdminIds(ProfileService profileService) { if (admin_ids == null || admin_ids.isEmpty()) return null; diff --git a/src/main/java/app/repositories/BanRepository.java b/src/main/java/app/repositories/BanRepository.java index e7fa6cd..76715e9 100644 --- a/src/main/java/app/repositories/BanRepository.java +++ b/src/main/java/app/repositories/BanRepository.java @@ -17,13 +17,14 @@ public interface BanRepository extends PagingAndSortingRepository { "(:account_ids is null or b.account_id in :account_ids) and " + "(:begin_date is null or b.timestamp >= :begin_date) and " + "(:end_date is null or :end_date <= b.timestamp) and " + - "(:active is null or b.active = :active) and " + + "(:active_null is null or b.active = :active) and " + "(:admin_ids is null or b.unbanned_by_id in :admin_ids)") Page getBans(Pageable pageable, @Param(value = "ban_ids")List ban_ids, @Param(value = "account_ids") List account_ids, @Param(value = "begin_date") Timestamp begin_date, @Param(value = "end_date") Timestamp end_date, - @Param(value = "active") Boolean active, + @Param(value = "active_null") Integer active_null, + @Param(value = "active") boolean active, @Param(value = "admin_ids") List admin_ids); }