org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'list' in 'c

 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'list' in 'class com.bw.yun.pojo.Page'

报了这个错。今天一直都在该这个方法以及优化


我的是目的是:在我的dao中根据一个对象字段进行查询,返回一个 list<对象> ,我的实体类是这样的


然后我的sql语句是这样的


主要说一下这个collection是你实体类的字段名,item 是你给该字段起的别名 ,其他的大家应知道吧。

然后我的错误是把collection 写为list 其实是错误的。应该是实体类的字段名。

注意:

    Mapper.xml

<select id="getFileStrByDts" resultType="FileStr">
		select * from
		fileStr
		where dt in
		<foreach collection="dts" index="index" item="dt" open="("
			separator="," close=")">
			#{dt}
		</foreach>
		limit #{start_index},#{page_rows}
	</select>

接口中:

	/**
	 * 根据路径返回文件
	 * 
	 * @param dt
	 * @return
	 */
	public List<FileStr> getFileStrByDts(Page page);

就是这个样子的

原文地址:https://www.cnblogs.com/meiLinYa/p/9195828.html