Mybatis绑定异常
异常信息如下
代码如下
mapper.java
Integer findIngMrInStock(PmMiMrOrderStopDto dto);
mapper.xml
<select id="findIngMrInStock" resultType="java.lang.Integer">
SELECT
IFNULL(count(*),0)
FROM
pm_mi_concrete_receiving AS mod1
LEFT JOIN pm_mi_concrete_receiving_detail AS mod2 ON mod1.id = mod2.main_id
LEFT JOIN pm_mi_concrete_plan_detail AS mod3 ON mod2.order_detail_id = mod3.id
WHERE
mod1.bill_state_id IN ( '0', '1', '2' )
AND mod2.id is not null
-- 物资主表id位#{mainId} 的数据
<if test="dto.mainId!=null and dto.mainId!=''">
AND mod3.main_id = #{dto.mainId}
</if>
-- 物资子表数据为xxxx的数据
<if test="dto.detailId!=null and dto.detailId!=''">
AND mod3.id = #{dto.detailId}
</if>
</select>
异常总结
xml文件中看来不能使用注释-- 进行代码编写,xml还是会解析出来的