|
|
|
@ -23,15 +23,18 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService { |
|
|
|
|
private final JdbcTemplate jdbcTemplate; |
|
|
|
|
@Override |
|
|
|
|
public List<PlanFilterConfigOption> configOption() { |
|
|
|
|
List<String> filterNames = new ArrayList<>(); |
|
|
|
|
List<PlanFilterConfigOption> list = new ArrayList<>(); |
|
|
|
|
List<PlanFilterConfig> planFilterConfigs = planFilterConfigMapper.selectList(new LambdaQueryWrapper<>()); |
|
|
|
|
if (planFilterConfigs.isEmpty()){ |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
for (PlanFilterConfig planFilterConfig:planFilterConfigs){ |
|
|
|
|
if (!planFilterConfig.getPropertyIdAndValueSql().isEmpty()){ |
|
|
|
|
if (filterNames.contains(planFilterConfig.getFilterName())){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (planFilterConfig.getPropertyIdAndValueSql()!=null){ |
|
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(planFilterConfig.getPropertyIdAndValueSql()); |
|
|
|
|
// List<Map<String, Object>> maps = SqlRunner.db().selectList(planFilterConfig.getPropertyIdAndValueSql());
|
|
|
|
|
List<Option<String>> options = maps.stream().map(obj -> { |
|
|
|
|
String value = obj.get("property_id").toString(); |
|
|
|
|
String label = obj.get("value").toString(); |
|
|
|
@ -53,8 +56,8 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService { |
|
|
|
|
); |
|
|
|
|
List<Option<String>> options = planFilterConfigList.stream().map(obj -> { |
|
|
|
|
Option<String> option = new Option<>(); |
|
|
|
|
option.setLabel(obj.getPropertyId()); |
|
|
|
|
option.setValue(obj.getValue()); |
|
|
|
|
option.setLabel(obj.getValue()); |
|
|
|
|
option.setValue(obj.getPropertyId()); |
|
|
|
|
return option; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
PlanFilterConfigOption planFilterConfigOption = new PlanFilterConfigOption(); |
|
|
|
@ -64,6 +67,7 @@ public class PlanFilterConfigServiceImpl implements PlanFilterConfigService { |
|
|
|
|
list.add(planFilterConfigOption); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
filterNames.add(planFilterConfig.getFilterName()); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|