SELECT
SUM(a.reward_amount)
FROM
contract_order a
LEFT JOIN follow_follower_order_relation b ON a.id = b.order_id
WHERE
a.member_id = #{memberId}
AND b.order_type = 2
and b.trade_id = #{tradeId};
SELECT
SUM(a.bond_amount)
FROM
contract_order a
LEFT JOIN follow_follower_order_relation b ON a.id = b.order_id
WHERE
a.member_id = #{memberId}
AND b.order_type = 2
and b.trade_id = #{tradeId};
SELECT
*
FROM
follow_follower_profit
WHERE
member_id = #{id}
and is_follow = #{isFollowY}
order by create_time desc
SELECT
id,
member_id memberId,
trade_id tradeId,
trade_member_id tradeMemberId,
total_principal totalPrincipal,
is_follow isFollow,
total_profit totalProfit
FROM
follow_follower_profit
WHERE
trade_member_id = #{tradeMemberId}
and is_follow = 1
order by create_time desc
SELECT
*
FROM
follow_follower_profit
WHERE
member_id = #{memberId}
and is_follow = 1
order by create_time desc
SELECT
*
FROM
follow_follower_profit
WHERE
trade_member_id = #{memberId}
and is_follow = 1
order by create_time desc
SELECT
*
FROM
contract_order
WHERE
member_id = #{memberId}
and contract_type = 2
and order_type in (3,4)
order by create_time desc
SELECT
*
FROM
contract_hold_order
WHERE
member_id = #{memberId}
and contract_type = 2
order by create_time desc
SELECT
*
FROM
contract_hold_order
WHERE
member_id = #{memberId}
and contract_type = 2
SELECT
*
FROM
follow_follower_profit
WHERE
member_id = #{memberId}
and trade_id = #{traderId}
update follow_follower_profit
set total_principal=total_principal+#{principal},
total_profit=total_profit+#{profit}
where trade_member_id=#{tradeMemberId} and member_id=#{memberId}
select count(1) from follow_follower_profit
where trade_member_id=#{tradeMemberId} and is_follow = 1
select sum(total_profit)
from follow_follower_profit
where trade_member_id=#{tradeMemberId}