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

谁借莪1个温暖的怀抱¢ 2023-10-18 18:37 176阅读 0赞

错误*Mapper.xml文件:

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

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

正确*Mapper.xml 文件:

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

发表评论

表情:
评论列表 (有 0 条评论,176人围观)

还没有评论,来说两句吧...

相关阅读