程序其他sql都執行正常,也寫了@param注解,但是還是一直報parameter ‘id’ not found。最后發現是調用sql的實現類里ids的入參對象名稱不叫ids,叫idList
代碼如下:
List<Map<String,String>> result=mapper.sql(date,ids);---就是這里的入參跟mapper不一致
List<A> sql(@Param("date") Integer date,@Param("ids")List<String> ids);
<select id="sql" resultType="java.util.Map">
select a,b,c from tablewhere date>=#{date}and id in (<foreach collection="ids" item="id" seperator=",">#{id}</foreach>)
</select>