org.apache.ibatis.binding.BindingException: Parameter 'item' not found. Available parameters are [state, type, keyword, param3, list, param4, param1, param2]
at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:204) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:45) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:219) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.executor.CachingExecutor.createCacheKey(CachingExecutor.java:146) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.6.jar:3.4.6]
at
@Select({"SELECT COUNT(id) FROM (",
"SELECT 0 AS type,a.id,a.batchNumber AS number, a.warehouseTime AS operateTime, a.operator,",
"a.modifyTime, a.consumerId,a.state,b.realname,a.houseId,c.name AS houseName",
"FROM warehouse a",
"LEFT JOIN consumer b ON a.consumerId = b.id",
"LEFT JOIN storehouse c ON a.houseId = c.id",
"WHERE 1",
// "<if test='type != null'>",
// "AND type = #{type}",
// "</if>",
// "<if test='state != null'>",
// "AND a.state = #{state}",
// "</if>",
"<if test='list != null'>",
"AND a.houseId IN",
"<foreach collection='list' item='item' open='(' separator=',' close=')'>",
"#{item}",
"</foreach>",
"</if>",
// "<if test='keyword != null'>",
// "AND (c.houseName like #{keyword} OR a.batchNumber like #{keyword} OR b.realname like #{keyword})",
// "</if>",
// "UNION",
// "SELECT 1 AS type,a.id,a.number, a.outboundTime AS operateTime, a.operator, a.modifyTime, a.consumerId,",
// "a.state,b.realname,a.houseId,c.name AS houseName",
// "FROM outbound a LEFT JOIN consumer b ON a.consumerId = b.id",
// "LEFT JOIN storehouse c ON a.houseId = c.id",
// "WHERE 1",
经过分析代码发现注解书写有问题没有添加<script></script>标记,添加<script></script>后可以正常解析SQL