Mybatis空指针

查询数据,返回的字段要在 resultMap 中定义,

 <resultMap id="BaseResultMap" type="com...." >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="title" property="title" jdbcType="VARCHAR" />
    <result column="open_app_public" property="openAppPublic" jdbcType="INTEGER" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com..." extends="BaseResultMap" >
    <result column="image_text_introduction" property="imageTextIntroduction" jdbcType="LONGVARCHAR" />
  </resultMap>
  
  <sql id="Base_Column_List" >
    id, title
  </sql>
  <sql id="Blob_Column_List" >
    image_text_introduction
  </sql>
  
  <select id="queryPage" resultMap="BaseResultMap">
       select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_information_event
    where 1=1 and open_app_public=1
  </select>
原文地址:https://www.cnblogs.com/yrjns/p/11353787.html