使用JPA写原生sql时,如果用到了in,则参数要传一个List,不能传字符串。
尝试过写成"‘aaa’,‘bbb’,‘ccc’"然后传入,不可行。
@Query(value = "select count(tool),tool,to_char(create_time,'yyyy-MM-dd') as create_time from t_xbsj_tool_use_log where create_time >= ?1 " +
"and create_time <=?2 and tool in ( ?3 ) group by to_char(create_time,'yyyy-MM-dd'),tool order by create_time asc",nativeQuery = true)
List<JSONObject> findToolStatisticWithTool(Date startTime, Date endTime,List tools);