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

虾米哥 阅读:825 2021-03-31 18:11:23 评论:0

错误*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>

 

声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

我的关注

全民解析

搜索
关注我们