MyBatis 提示:A query was run and no Result Maps were found for the Mapped Statement

错误*Mapper.xml文件:

<!--通用查询语句  -->
  <select id="select" parameterType="map">
  	 select sid, name_, `type_`, `length`, decimal_, required, primary_, default_value, 
    	comment_, create_dt, create_by, update_dt, update_by, bus_table_id, version, `state`, 
    	delete_flag, code_, desc_
    	from ucas_bus_column
    	where 1 = 1
    	<if test="busTableId != null and busTableId !=''">
    		and bus_table_id = #{busTableId,jdbcType=VARCHAR}
    	</if>
    	<if test="notBusTableId != null and notBusTableId !=''">
    		and <![CDATA[ bus_table_id <> #{notBusTableId,jdbcType=VARCHAR} ]]>
    	</if>
  </select>

错误原因:缺少配置resultMap 标签

正确*Mapper.xml 文件:

<select id="select" parameterType="map" resultMap="BaseResultMap">
  	 select sid, name_, `type_`, `length`, decimal_, required, primary_, default_value, 
    	comment_, create_dt, create_by, update_dt, update_by, bus_table_id, version, `state`, 
    	delete_flag, code_, desc_
    	from ucas_bus_column
    	where 1 = 1
    	<if test="busTableId != null and busTableId !=''">
    		and bus_table_id = #{busTableId,jdbcType=VARCHAR}
    	</if>
    	<if test="notBusTableId != null and notBusTableId !=''">
    		and <![CDATA[ bus_table_id <> #{notBusTableId,jdbcType=VARCHAR} ]]>
    	</if>
  </select>

猜你喜欢

转载自blog.csdn.net/zhouzhiwengang/article/details/90230051