java代码中有有两个方法,方法体的代码一样,入参类型不一样,返回类型是各自的入参类型,该如何解藕?
代码如下
public static <T, F> void cutInParameter(LambdaQueryWrapper<T> wrapper, SFunction<T, ?> column, Collection<F> coll) {
List<List<F>> newList = splitList(coll, paramNums);
if (CollectionUtils.isNotEmpty(newList)) {
if(newList.size() ==1){
wrapper.in(column, newList.get(0));
}else{
wrapper.and(i -> {
i.in(column, newList.get(0));
newList.remove(0);
for (List<F> objects : newList) {
i.or().in(column, objects);
}
});
}
}else{
wrapper.eq(column, null);
}
}
public static <T, F> void cutInParameter(LambdaUpdateWrapper<T> wrapper, SFunction<T, ?> column, Collection<F> coll) {
List<List<F>> newList = splitList(coll, paramNums);
if (CollectionUtils.isNotEmpty(newList)) {
if(newList.size() ==1){
wrapper.in(column, newList.get(0));
}else{
wrapper.and(i -> {
i.in(column, newList.get(0));
newList.remove(0);
for (List<F> objects : newList) {
i.or().in(column, objects);
}
});
}
}
}