sqlMap中查询列注意点

<sql id="Base_Column_List">
  <!--
    WARNING - @mbggenerated
    This element is automatically generated by MyBatis Generator, do not modify.
  -->
  type, bank_id, md5_key, mch_id, account_no, risk_des3_key, risk_md5_key, risk_no, 
  risk_key, risk_gateway_code, rsa_public_key
</sql>
<sql id="Blob_Column_List">
  <!--
    WARNING - @mbggenerated
    This element is automatically generated by MyBatis Generator, do not modify.
  -->
  private_key
</sql>

mybatis自动生成这些查询字段

如果有字段类型是text类型的时候,生成工具生成了单独的查询列 例如

Blob_Column_List

所以,我们在sqlMap中写查询语句的时候,不要忘记了这个,否则该列返回为空

<select id="myquery" resultMap="ResultMapWithBLOBs">

    SELECT
    <include refid="Base_Column_List"/>,
    <include refid="Blob_Column_List"/>
    FROM
    my_table
    WHERE mch_id=#{mchId} AND type = #{type}
    limit 1

</select>

 

发表评论

邮箱地址不会被公开。