mapper接口:
有问题的xml:
<!--到位-->
<if test="condition.completed != null and (condition.completed = '0' or condition.completed='1')" >
<choose>
<when test="condition.completed = '0'">
and a.vrfamount = a.totalamount
and a.invoiceamount = a.totalamount
</when>
<otherwise>
<![CDATA[ and (a.vrfamount <> a.totalamount or a.invoiceamount <> a.totalamount) ]]>
</otherwise>
</choose>
</if>
前端传入:
"completed": "0"
还是传入:
"completed": "1"
都走的这个:
and a.vrfamount = a.totalamount
and a.invoiceamount = a.totalamount
修改了方式:
<if test="condition.completed != null">
<if test="condition.completed == '0'">
and a.vrfamount = a.totalamount and a.invoiceamount = a.totalamount
</if>
<if test="condition.completed == '1'">
<![CDATA[
and (a.vrfamount <> a.totalamount or a.invoiceamount <> a.totalamount)
]]>
</if>
</if>
前端传入:
"completed": "0"
还是传入:
"completed": "1"
哪个条件都不走。
请问为啥,我想要的是传入0走and a.vrfamount = a.totalamount and a.invoiceamount = a.totalamount
传入1走:and (a.vrfamount <> a.totalamount or a.invoiceamount <> a.totalamount)
啥也不传就啥也不走。哪里有问题呀?