select * from v_instock where factory_id='123456' and (id,lot_no,shelfid) not in ( select material_id,lot_no,shelf_id from wh_check_dtl WHERE check_plan_id = '456789');
用第二个参数查到的列作为not in 的条件
动态SQL:
<select id="selectbyareaid" parameterType="string" resultMap="InstockResult"> select * from v_instock where warehouse_area_ld = #{id} and (id,lot_no,shelfid) not in ( select material_id,lot_no,shelf_id from wh_check_dtl WHERE check_plan_id = #{planid}) </select>