There is no getter for property named 'xxxxx' in 'class java.lang.String'

mapper.xml,实体类,和mapper接口都是用generator生成的。不会有问题。

我也仔细检查了一下,确实没问题。

会报这个错误的mapper.xml如下:

<select id="selectByStatisticsDate" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from pn_price_statistics
    <if test="statisticsDate != null">
      WHERE statistics_date like  "%"#{statisticsDate}"%"
    </if>
  </select>

问题应该出在<if>中。以前使用if的时候,传递的参数类型为map

 

这次网上的解决方案:用_parameter来接收参数,正确的mapper.xml如下:

 <select id="selectByStatisticsDate" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from pn_price_statistics
    <if test="_parameter != null">
      WHERE statistics_date like  "%"#{_parameter}"%"
    </if>
  </select>

这个解决方案是建立在你检查过参数,确认没有拼写错误。 

——在工作中发现问题,大家一起进步

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值