测试queryShopCount方法出现一个很奇怪的现象,如果去掉方法中的参数注解@Pram(“shopCondition”),如下第二行的写法:
int queryShopCount(@Param(“shopCondition”) Shop shopCondition);
int queryShopCount(Shop shopCondition);
测试运行就出错,错误提示如下:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘shopCondition’ in ‘class com.imooc.o2o.entity.Shop’
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘shopCondition’ in ‘class com.imooc.o2o.entity.Shop’
xml文件代码如下:
select count(1)
from tb_shop s
left join tb_area a
on a.area_id=s.area_id
left join tb_shop_category c
on s.shop_category_id=c.shop_category_id
and s.shop_name like %+#{shopCondition.shopName}+%
and s.shop_category_id=#{shopCondition.shopCategory.shopCategoryId}
and s.area_id=#{shopCondition.area.areaId}
and s.enable_status=#{shopCondition.enableStatus}
and s.owner_id=#{shopCondition.owner.userId}
请问这是什么原因呢?
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程