mybatis异常 栏位索引超过许可范围:2,栏位数:1。

异常信息

  • Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1。

mapper文件sql

<select id="findByCondition" parameterType="com.onesports.swms.dao.model.bo.store.QueryStockDTO" resultType="com.onesports.swms.dao.model.bo.store.AssetStoreBo">
    SELECT
      store.id,
      store.asset_code,
      asset.asset_name,
      asset.asset_type,
      dict1.value_name asset_type_name,
      asset.org_code,
      org.org_name,
      asset.rfid_code,

      store.storage_code,
      storage.storage_name,
      store.shelf_code,
      shelf.shelf_name,
      store.shelf_region_code,
      region.shelf_region_name,

      store.stored_state,
      dict2.value_name stored_state_name,

      store.stored_num,
      store.min_rational_num,
      store.max_rational_num,
      store.warning_flag
    FROM wms_asset_store store
      JOIN wms_asset_bas asset ON store.asset_code = asset.asset_code AND asset.enabled = TRUE
      JOIN sys_dict_conf dict1 ON asset.asset_type = dict1.value_type AND dict1.code_type = 'ASSET_TYPE'
      JOIN wms_organization_bas org ON asset.org_code = org.org_code AND org.enabled = TRUE
      JOIN wms_storage_bas storage ON store.storage_code = storage.storage_code AND storage.enabled = TRUE
      LEFT JOIN wms_shelf_bas shelf ON shelf.enabled = TRUE AND store.shelf_code = shelf.shelf_code
      LEFT JOIN wms_shelf_region region ON region.enabled = TRUE AND region.shelf_region_code = store.shelf_region_code
      LEFT JOIN sys_dict_conf dict2 ON store.stored_state = dict2.value_type AND dict2.code_type = 'STORE_STATE'
    -- 通过IN和递归查询查看本单位及子单位数据
    WHERE 1 = 1
    <if test="dto.orgCode != null">AND asset.org_code = #{dto.orgCode}</if>
    <if test="dto.storageCode != null">AND store.storage_code = #{dto.storageCode}</if>
    <if test="dto.shelfCode != null">AND store.shelf_code = #{dto.shelfCode}</if>
    <if test="dto.shelfRegionCode != null">AND store.shelf_region_code = #{dto.shelfRegionCode}</if>
    <if test="dto.assetCode != null">AND asset.asset_code LIKE #{dto.assetCode}</if>
    <if test="dto.assetName != null">AND asset.asset_name LIKE #{dto.assetName}</if>
    <if test="dto.storeState != null">AND store.stored_state = #{dto.storeState}</if>
--查询关键字 字段 资产名称,资产编码,资产类型
    <if test="dto.keyword != null">
      AND (
      asset.asset_name LIKE #{dto.keyword} OR
      store.asset_code LIKE #{dto.keyword} OR
      asset.asset_type LIKE #{dto.keyword}
      )
    </if>
    <if test="dto.hasStock != null">
      <choose>
          <when test="dto.hasStock">AND store.stored_num > 0 </when>
          <otherwise>AND store.stored_num = 0 </otherwise>
      </choose>
    </if>

异常是这段注释导致的,推测可能是占位符填充数据时导致的,具体原因不解。
在这里插入图片描述

  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值