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>

异常是这段注释导致的,推测可能是占位符填充数据时导致的,具体原因不解。
mybatis异常 栏位索引超过许可范围:2,栏位数:1。_第1张图片

你可能感兴趣的:(Java,架构)