Мой текущий mybatis mapper.xml
<select id = "batchSelect" resultMap = "ResultMap">
select id, user_id, mall_id, log, log_type
from user_log
where user_id in (
<foreach collection = "userList" index = "index" item = "item" separator = ",">
#{item,jdbcType=VARCHAR}
</foreach>
) and mall_id = #{1}
</select>
Java Mapper.java - это
List<UserLog> batchSelect(List<String> userList, Long mallId);
Когда я запускаю службу весенней загрузки, исключение:
exception: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userList' not found. Available parameters are [0, 1, param1, param2]
Как мне это правильно написать?




можно использовать аннотацию @Param
List<UserLog> batchSelect(@Param("userList")List<String> userList, @Param("mailId")Long mallId);
<select id = "batchSelect" resultMap = "ResultMap">
select id, user_id, mall_id, log, log_type
from user_log
where user_id in (
<foreach collection = "userList" index = "index" item = "item" separator = ",">
#{item,jdbcType=VARCHAR}
</foreach>
) and mall_id = #{mailId}
</select>
на самом деле mybatis-generator поддерживает selectByExample, updateByExample, все они поддерживают пункт where in.
это мой окончательный выбор
ОК, я попробую это