mybatis传数组参数和List参数时if-test判空

2020-12-03  本文已影响0人  shenzhao_f9aa

Mapper :

List getInvoiceCompanyForPay(

@Param("idList") List idList,

@Param("isPaying") Integer isPaying,

@Param("payPlanDate") String payPlanDate);


XML:

<if test="idList != null and  idList.size()>0">

AND id IN

<foreach collection="idList" item="id" separator="," open="(" close=")">

#{id, jdbcType=INTEGER}

</foreach>

</if>

这里尤其需要注意 and ,必须为小写,大写的话是会报错

org.apache.ibatis.ognl.ParseException: Encountered " <IDENT> "AND ""

上一篇 下一篇

猜你喜欢

热点阅读