中文字幕精品亚洲无线码二区,国产黄a三级三级三级看三级,亚洲七七久久桃花影院,丰满少妇被猛烈进入,国产小视频在线观看网站

java~springboot~ibatis Invalid bound statement (not found)原因

事實起因

最近在ORM上使用了ibatis,感覺挺繁瑣的,沒有jpa來的直接,但項目非要用也沒有辦法,最近在進行開發過程中出現了一個問題Invalid bound statement (not found)意思是說,你的xml映射和你的mapper方法不一致,這種(zhong)不一致大叔總結(jie)幾(ji)點,如果你出(chu)現了這種(zhong)問題可以按著下面幾(ji)后(hou)進行排查。

可能出現的原因

  1. xml輸入參數類型不匹配,你可以改成parameterType="map"試試
  2. xml返回參數類型問題,resultType="你的類型",不要寫成resultMap="你的類型"
  3. 返回的DTO與返回結果集名稱不匹配,這時你要對照類型的屬性,去為sql設置別名
  4. yml文件里對ibatis配置有問題
    如下面代碼:
@Getter
@Setter
public class BusinessCustomerDTO {
  private Long id;
  private String customerName;
  private String contactPerson;
  private Integer freeDays;
  private String city;
  private String province;
  private String source;
  private LocalDateTime enterDays;
  private String leadingPerson;
}

對應的mapper代(dai)碼:

  <select id="getBusinessCustomers" parameterType="java.util.Map" resultType="cn.pilipa.customer.management.dto.BusinessCustomerDTO">
        select a.id,
        a.customer_name as customerName,
        a.city_code as city,
        a.province_code as province,
        a.customer_source as source,
        b.enter_storage_time as enterDays,
        b.current_salesperson as leadingPerson,
        c.contact_person as contactPerson from customer_base_info a
        inner join customer_business_info b on a.id=b.customer_id
        left join customer_contact_person  c on c.customer_id=a.id
        where c.is_main_contact=1
    </select>
posted @ 2018-09-19 15:44  張占嶺  閱讀(2885)  評論(0)    收藏  舉報