SEBSERV-425 fixed (also tests)
This commit is contained in:
		
							parent
							
								
									2355db41a5
								
							
						
					
					
						commit
						7ef5f91d42
					
				
					 1 changed files with 33 additions and 21 deletions
				
			
		|  | @ -24,6 +24,8 @@ import org.apache.commons.lang3.BooleanUtils; | |||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.joda.time.DateTime; | ||||
| import org.joda.time.DateTimeZone; | ||||
| import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter; | ||||
| import org.mybatis.dynamic.sql.select.QueryExpressionDSL; | ||||
| import org.springframework.cache.CacheManager; | ||||
| import org.springframework.context.ApplicationEventPublisher; | ||||
| import org.springframework.context.annotation.Lazy; | ||||
|  | @ -130,7 +132,10 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO { | |||
|             final FilterMap filterMap, | ||||
|             final Predicate<SEBClientConfig> predicate) { | ||||
| 
 | ||||
|         return Result.tryCatch(() -> this.sebClientConfigRecordMapper | ||||
|         return Result.tryCatch(() -> { | ||||
| 
 | ||||
|             QueryExpressionDSL<MyBatis3SelectModelAdapter<List<SebClientConfigRecord>>>.QueryExpressionWhereBuilder query = | ||||
|                     this.sebClientConfigRecordMapper | ||||
|                             .selectByExample() | ||||
|                             .where( | ||||
|                                     SebClientConfigRecordDynamicSqlSupport.institutionId, | ||||
|  | @ -138,20 +143,27 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO { | |||
|                             .and( | ||||
|                                     SebClientConfigRecordDynamicSqlSupport.name, | ||||
|                                     isLikeWhenPresent(filterMap.getName())) | ||||
|                 .and( | ||||
|                         SebClientConfigRecordDynamicSqlSupport.date, | ||||
|                         isGreaterThanOrEqualToWhenPresent(filterMap.getSEBClientConfigFromTime()), | ||||
|                         or(SebClientConfigRecordDynamicSqlSupport.active, isNotEqualTo(0))) | ||||
|                             .and( | ||||
|                                     SebClientConfigRecordDynamicSqlSupport.active, | ||||
|                         isEqualToWhenPresent(filterMap.getActiveAsInt())) | ||||
|                 .build() | ||||
|                                     isEqualToWhenPresent(filterMap.getActiveAsInt())); | ||||
| 
 | ||||
|             final DateTime sebClientConfigFromTime = filterMap.getSEBClientConfigFromTime(); | ||||
|             if (sebClientConfigFromTime != null) { | ||||
| 
 | ||||
|                 query = query.and( | ||||
|                         SebClientConfigRecordDynamicSqlSupport.date, | ||||
|                         isGreaterThanOrEqualTo(sebClientConfigFromTime), | ||||
|                         or(SebClientConfigRecordDynamicSqlSupport.active, isNotEqualTo(0))); | ||||
|             } | ||||
| 
 | ||||
|             return query.build() | ||||
|                     .execute() | ||||
|                     .stream() | ||||
|                     .map(this::toDomainModel) | ||||
|                     .flatMap(DAOLoggingSupport::logAndSkipOnError) | ||||
|                     .filter(predicate) | ||||
|                 .collect(Collectors.toList())); | ||||
|                     .collect(Collectors.toList()); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti