我想遍历列表,但我得到了异常
if (prime)
{
var primeText = string.Format("Prime: {0}", i);
Console.WriteLine(primeText );
File.AppendAllText(@"C:\Users\mens\Documents\PriemGetallen.txt",
primeText + Environment.NewLine);
}
我的java代码:
org.apache.ibatis.mapping.SqlMapperException: The expression 'list' evaluated to a null value.
MyMapper.xml:
public List<SearchVO> getSearchResultByParams(List<String> selectedGroups) {
Map map = new HashMap(1);
map.put("selectedGroups", selectedGroups);
return MyMapper.getSearchResultByParams(map);
}
答案 0 :(得分:0)
首先确保您在mybatis-config文件 typeAliases 标记
中为java.util.HashMap设置了别名 map<select id="getSearchResultByParams" parameterType="map" resultMap="SearchResultMap">
SELECT *
FROM WORK
WHERE ID IN
<foreach collection="selectedGroups" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
收藏必须是您在地图中列出的关键
该文档可能会帮助您http://mybatis.github.io/mybatis-3/dynamic-sql.html
答案 1 :(得分:0)
添加
后,我解决了类似的错误public SearchResultMap getSearchResultByParams(@Param("selectedGroups") List<String> selectedGroups)
我的意思是 @Param
注释