liujie
2 天以前 c8e080d65e26158ea62c98548a11e9aa75c2112e
ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -108,7 +108,7 @@
        <if test="user.roleType != null and user.roleType == 4 ">
            and t1.goods_source =1 and t1.supplier_clinic_id =#{query.supplierClinicId}
        </if>
        <if test="user.roleType != null and user.roleType == 5 ">
        <if test="user.roleType != null and user.roleType == 5">
            and ( ( t1.goods_source =2 and  t1.supplier_clinic_id =#{query.supplierClinicId} ) or  find_in_set(#{query.supplierClinicId},t1.clinic_ids) )
        </if>
        GROUP BY t1.id
@@ -157,5 +157,23 @@
        </if>
        order by t1.create_time desc
    </select>
    <select id="pageList1" resultType="com.ruoyi.system.vo.TErpGoodsVO">
        select * from (
        select <include refid="Base_Column_List1"/>
        COALESCE(sum(t2.purchase_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum,
        SUM(t2.unit_amount * (t2.purchase_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice,
        COALESCE(sum(t3.outbound_count), 0) as outNum
        from t_erp_goods t1  left join  t_erp_clinic_warehousing_batch t2  on t1.id = t2.goods_id
        left join  t_erp_clinic_outbound_goods t3 on t2.id = t3.warehousing_id
        where t1.disabled = 0 and t2.id is not null
         and   t1.goods_source =2 and  t1.supplier_clinic_id =#{query.supplierClinicId}
        GROUP BY t1.id
        ) o where 1=1
        <if test="query.type != null and query.type ==1">
            and  o.warning_inventory  > (o.allNum-o.outNum)
        </if>
        order by o.create_time desc
    </select>
</mapper>