org.jdbi.v3.core.statement.UnableToCreateStatementException:在查询声明无时提供了多余的命名参数

问题描述

    return [i for x in final_expression for i in x]

我想从 userTypes 列表中获取 Id 列表。
这里 User.UserType 是一个枚举。在方法(getUserIdsBylistofTypes)中,我传递了枚举类型列表的参数(userTypes)。
我无法理解查询中的问题在哪里。

解决方法

我没有采用枚举类型的列表,而是采用了字符串列表。

@SqlQuery("Select id from user where type::text in (<userType>)")   
List<Long> getUserIdsByListOfTypes(@BindList("userType") List<String> userType);  

How to search an enum in list of strings by postgresql query?