nested exception is org.apache.ibatis.binding.BindingException: Parameter “startIndex” not found.

在做后台项目查询MQ消息的时候,报错
代码如下:
  • biz
    @Override
    protected List queryPaging(int startIndex, int pageSize, Object... objs) {
        QueryPagingUrlMessageRequest request = (QueryPagingUrlMessageRequest) objs[0];
        List<Integer> ids = null;
        if (request.getItemId() != null){
            ids = itemService.getConfigList(request.getItemId(),Constants.URL_MESSAGE_LIST);
            if (CollectionUtils.isEmpty(ids)){
                return new ArrayList<>();
            }
        }
        UrlMessageCondition condition = new UrlMessageCondition();
        BeanUtils.copyProperties(request,condition);
        condition.setIds(ids);
        return urlMessageService.pagingQuery(condition,startIndex,pageSize);
    }
这里的pagingQuery方法中出现了startIndex,最终是为了mabatis中limit时求开始索引

starrtIndex = pageSize * (pageIndex - 1)

  • service
    public List<UrlMessage> pagingQuery(UrlMessageCondition condition, int startIndex, int pageSize) {
        return mapper.selectByPidAndurlMessageAndCreator(condition,startIndex,pageSize);
    }
  • mapper
    List<UrlMessage> selectByPidAndurlMessageAndCreator(
            @Param("condition") UrlMessageCondition condition,
            @Param("startIndex") int startIndex,
            @Param("pageSize") int pageSize);
!!!问题出在了这里!!!,@Param(“startIndex”) int startIndex ,拼写错误·······导致sql语句的limit #{startIndex},#{pageSize} 中找不到startIndex
  • .xml
<select id="selectByPidAndurlMessageAndCreator" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from wpm_config_url_message
    where
    STATUS=1
    <if test="condition.pid != null">
      and PID =#{condition.pid}
    </if>
    <if test="condition.name != null">
      and NAME like CONCAT('%',#{condition.name},'%')
    </if>
    <if test="condition.topic != null">
      and TOPIC like CONCAT('%',#{condition.topic},'%')
    </if>
    <if test="condition.creator != null">
      and CREATOR =#{condition.creator}
    </if>
    <if test="condition.ids != null">
      and ID in
      <foreach collection='condition.ids' item='id'
               open='('
               close=')'
               separator=','>
        #{id}
      </foreach>
    </if>
    <if test="condition.responsibleOwner != null">
      and RESPONSIBLE_OWNER =#{condition.responsibleOwner}
    </if>
    order by ID
    limit #{startIndex},#{pageSize}
  </select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值