mybatis 查询list,内容为null,但list的size 为1,显示 All elements are null

如题所述

第1个回答  2022-06-11
发料单删除校验接口

<!-- 查看当前发料单是否已被盘点消耗引用-->

<select id="quotaCheck"  resultType="InventoryConsumption">

SELECT DISTINCT

    wic.*

FROM

    wz_issue wi

    LEFT JOIN wz_inventory_consumption wic ON wi.issue_date<= wic.inventory_date

    AND wi.receive_warehouse_id = wic.inventory_warehouse_id

    AND wi.receive_construction_team_id = wic.construction_team_id

    AND wic.del_flag = 0

WHERE

    wi.id in (${ids})

</select>

这里应该把wz_inventory_consumption 作为主表,左连接wz_issue表,因为wz_issue表中一定会有某条发料单,但wz_inventory_consumption 不一定有盘点消耗单,这样就是查出来wic.*为空,但wi.*不是空。

另外一个办法就是,不做如上修改,在SQL的WHERE中加上 wic.id is not null,把空数据去掉

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网