1. 程式人生 > >searchable中((A&&B)||(C&&D))的情況

searchable中((A&&B)||(C&&D))的情況

Searchable searchable = new SearchRequest();
searchable.setPage(page - 1, rows);

OrCondition orCondition;
            
SearchFilter filterOne = SearchFilterHelper.newCondition("createUserId_eq", useID);
SearchFilter filterTwo = SearchFilterHelper.newCondition("isSupervise_eq", 0);

SearchFilter filter = SearchFilterHelper.and(filterOne, filterTwo);

//負責人id等於登入使用者id
SearchFilter filter1 = SearchFilterHelper.newCondition("respDepartmentId_eq", useID);
// 狀態為已下達
SearchFilter filter2 = SearchFilterHelper.newCondition("flowState_eq", SuperviseStateEnum.goDown.getCode());

SearchFilter searchFilter = SearchFilterHelper.and(filter1, filter2);

orCondition = (OrCondition) SearchFilterHelper.or(filter);
orCondition.add(searchFilter);

searchable.addSearchFilter(orCondition);
this.find(searchable);