|
@@ -4,18 +4,30 @@
|
|
|
|
|
|
<select id="getListByCondition" resultType="com.yh.saas.plugin.yiliangyiyun.entity.CostManagementInfo">
|
|
<select id="getListByCondition" resultType="com.yh.saas.plugin.yiliangyiyun.entity.CostManagementInfo">
|
|
SELECT
|
|
SELECT
|
|
- wo.warehouse_name as warehouseName,
|
|
|
|
- wo.goods_name as goodsName,
|
|
|
|
- SUM(wo.surplus_weight) as storage,
|
|
|
|
- ROUND(AVG(wo.avg_cost),3 )as cost
|
|
|
|
|
|
+ wbi.warehouse_name AS warehouseName,
|
|
|
|
+ wpsi.goods_name AS goodsName,
|
|
|
|
+ wpsi.`storage` AS STORAGE,
|
|
|
|
+ ROUND(AVG(wo.avg_cost), 3) AS cost
|
|
FROM
|
|
FROM
|
|
- warehousing_order wo
|
|
|
|
- left join warehouse_base_info wbi on wbi.warehouse_name = wo.warehouse_name and wbi.warehouse_type = 1
|
|
|
|
- WHERE
|
|
|
|
- wo.delete_flag = 0
|
|
|
|
- AND wo.surplus_weight > 0
|
|
|
|
- and wbi.delete_flag = 0
|
|
|
|
- and wo.comp_id = #{compId}
|
|
|
|
- GROUP BY wo.goods_name,wo.warehouse_name
|
|
|
|
|
|
+ warehouse_base_info wbi
|
|
|
|
+ LEFT JOIN warehousing_order wo ON wbi.warehouse_name = wo.warehouse_name
|
|
|
|
+ AND wo.delete_flag = 0
|
|
|
|
+ AND wbi.comp_id = wo.comp_id
|
|
|
|
+ LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
|
|
|
|
+ AND wpi.delete_flag = 0
|
|
|
|
+ LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
|
|
|
|
+ AND wpsi.delete_flag = 0
|
|
|
|
+ AND wpsi.goods_name = wo.goods_name
|
|
|
|
+ WHERE 1=1
|
|
|
|
+ and wpsi.`storage` > 0
|
|
|
|
+ AND wbi.warehouse_type = 1
|
|
|
|
+ AND wbi.delete_flag = 0
|
|
|
|
+ AND wbi.comp_id =#{compId}
|
|
|
|
+ <if test="jointVentureParties != null">
|
|
|
|
+ AND wbi.joint_venture_parties = #{jointVentureParties}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ wpsi.goods_name,
|
|
|
|
+ wbi.warehouse_name
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|