liujie
5 天以前 1e90b1eea46cf72e7111a1ced9eff8c451304240
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -105,4 +105,54 @@
        order by create_time desc
    </select>
    <select id="pageInventoryGoodsPageList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO">
select  * from (
        SELECT t1.id,t2.warehouse_no,
               t3.goods_name,
               t4.supplier_name,
               t3.type_id,
               t3.packing_unit_id,
               t3.quasi_number,
               t3.goods_id_code,
               t1.batch_number,
               coalesce(sum(t5.outbound_count),0) as outbound_count,
               t1.warehousing_number,
               t2.create_time,
               t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num,
               t3.sales_amount,
               t1.expiry_date
        from t_erp_supplier_warehousing_batch t1
                 LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
                 LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id
                 LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id
                 LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id
        where t2.disabled = 0 and t2.warehouse_id = #{query.warehouseId}
        <if test="query.goodsName != null and query.goodsName != ''">
            and t3.goods_name like concat('%',#{query.goodsName},'%')
        </if>
        <if test="user.roleType ==4">
            and t3.supplier_clinic_id =#{user.userId}
        </if>
        <if test="query.supplierName != null and query.supplierName != ''">
            and t4.supplier_name like concat('%',#{query.supplierName},'%')
        </if>
        <if test="query.typeId != null and query.typeId != ''">
            and t3.type_id = #{query.typeId}
        </if>
        <if test="query.quasiNumber != null and query.quasiNumber != ''">
            and t3.quasi_number =#{query.quasiNumber}
        </if>
        <if test="query.batchNumber != null and query.batchNumber != ''">
            and t1.batch_number =#{query.batchNumber}
        </if>
        <if test="query.warehouseNo != null and query.warehouseNo != ''">
            and t2.warehouse_no = #{query.warehouseNo}
        </if>
) as o
where (o.warehousing_number -o.outbound_count) >0
order by o.create_time desc
    </select>
</mapper>