|
|
|
@ -3,5 +3,102 @@
|
|
|
|
|
<mapper namespace="jnpf.mapper.BusinessOrderProductRelationalMapper">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="getHomePageDataMap" type="map">
|
|
|
|
|
<!--采购平均价-->
|
|
|
|
|
<result property="avgPurchasePrice" column="avgPurchasePrice"/>
|
|
|
|
|
<!--今日采购量-->
|
|
|
|
|
<result property="todayPurchasePrice" column="todayPurchasePrice"/>
|
|
|
|
|
<!--今日销售量-->
|
|
|
|
|
<result property="salesVolumeToday" column="salesVolumeToday"/>
|
|
|
|
|
<!--待支付-->
|
|
|
|
|
<result property="unpaid" column="unpaid"/>
|
|
|
|
|
<!--今日付款-->
|
|
|
|
|
<result property="todayPay" column="todayPay"/>
|
|
|
|
|
<!--待回款-->
|
|
|
|
|
<result property="moneyCollected" column="moneyCollected"/>
|
|
|
|
|
<!--今日回款-->
|
|
|
|
|
<result property="todayPayment" column="todayPayment"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="getHomePageData" resultMap="getHomePageDataMap">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT( b.id ) AS avgPurchasePrice,
|
|
|
|
|
IFNULL( SUM( Round( IF ( b.unit = '千克', b.net_weight / 1000, net_weight ), 3 )), 0 ) AS todayPurchasePrice
|
|
|
|
|
FROM
|
|
|
|
|
jg_receipt_order a
|
|
|
|
|
LEFT JOIN jg_delivery_voucher_relation b ON a.id = b.order_id
|
|
|
|
|
AND b.f_delete_mark IS NULL
|
|
|
|
|
WHERE
|
|
|
|
|
-- to_days( a.f_creator_time ) = to_days(
|
|
|
|
|
-- now())
|
|
|
|
|
-- AND
|
|
|
|
|
a.f_delete_mark IS NULL
|
|
|
|
|
AND a.receipt_type = '1'
|
|
|
|
|
) a,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
IFNULL( SUM( Round( IF ( b.unit = '千克', b.net_weight / 1000, net_weight ), 3 )), 0 ) AS salesVolumeToday
|
|
|
|
|
FROM
|
|
|
|
|
jg_receipt_order a
|
|
|
|
|
LEFT JOIN jg_delivery_voucher_relation b ON a.id = b.order_id
|
|
|
|
|
AND b.f_delete_mark IS NULL
|
|
|
|
|
WHERE
|
|
|
|
|
to_days( a.f_creator_time ) = to_days(
|
|
|
|
|
now())
|
|
|
|
|
AND a.f_delete_mark IS NULL
|
|
|
|
|
AND a.receipt_type = '2'
|
|
|
|
|
) b,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
ROUND( IFNULL( SUM( IFNULL( a.apply_amount, 0 )), 0 ), 6 )/ 10000 unpaid -- 待支付
|
|
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
jg_cw_payment_receipt a
|
|
|
|
|
WHERE
|
|
|
|
|
a.`type` = '1'
|
|
|
|
|
AND a.apply_amount < a.payment_amount
|
|
|
|
|
AND a.f_delete_mark IS NULL
|
|
|
|
|
) c,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
ROUND( IFNULL( SUM( IFNULL( a.payment_amount, 0 )), 0 ), 6 )/ 10000 todayPay -- 今日支付
|
|
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
jg_cw_payment_receipt a
|
|
|
|
|
WHERE
|
|
|
|
|
a.`type` = '1'
|
|
|
|
|
AND to_days( a.f_creator_time ) = to_days(
|
|
|
|
|
now())
|
|
|
|
|
AND a.f_delete_mark IS NULL
|
|
|
|
|
) d,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
ROUND( IFNULL( SUM( IFNULL( a.apply_amount, 0 )), 0 ), 6 )/ 10000 moneyCollected -- 待回款
|
|
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
jg_cw_payment_receipt a
|
|
|
|
|
WHERE
|
|
|
|
|
a.`type` = '2'
|
|
|
|
|
AND a.apply_amount < a.payment_amount
|
|
|
|
|
AND a.f_delete_mark IS NULL
|
|
|
|
|
) e,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
ROUND( IFNULL( SUM( IFNULL( a.payment_amount, 0 )), 0 ), 6 )/ 10000 todayPayment -- 今日回款
|
|
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
jg_cw_payment_receipt a
|
|
|
|
|
WHERE
|
|
|
|
|
a.`type` = '2'
|
|
|
|
|
AND to_days( a.f_creator_time ) = to_days(
|
|
|
|
|
now())
|
|
|
|
|
AND a.f_delete_mark IS NULL
|
|
|
|
|
) f
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|