1)自定义组件
至
2)代码中调用
import YearRangeQuery from "@/views/data/YearRangeQuery";
components: {... ,YearRangeQuery},
3)后端代码修改
查询类
@Query(type = Query.Type.IN)
private List docyear;
QueryHelp.java
case IN:
String fieldtype = (field.getType().toString());
if(field.getType().toString().equalsIgnoreCase("interface java.util.List")){
if (CollUtil.isNotEmpty((List)val) ){ //val: [2020,2021,2022]
list.add(getExpression(attributeName,join,root).in(val));
}
}else if(field.getType().toString().equalsIgnoreCase("class java.lang.String")){
//字符串转Collect
String[] astr = val.toString().split(",");
// Stream stringStream = Stream.of(val.toString());
//List _list = stringStream.collect(Collectors.toList());
List nList = new ArrayList<>();
for(int i = 0 ;i)val)) { //val: [2,5,7]
list.add(getExpression(attributeName,join,root).in((Collection) val));
}
}
break;