SELECT
*
FROM
yd_order a
inner join yd_product b on b.id = a.product_id
and a.member_id = #{record.memberId}
and a.type=1
and a.state=#{record.state}
ORDER BY a.create_time DESC
select a.*, b.* from yd_order a
left join yd_product b on a.product_id=b.id
where a.state=2 and a.return_state=1
select a.*, b.id p_id, b.pro_unit, b.manage_expense from yd_order a
inner join yd_product b on a.product_id=b.id
where a.state=2 and a.type = 1
UPDATE yd_order s
SET s.state = #{state}
WHERE
id = #{id}
SELECT
*
FROM
yd_order a
inner join yd_product b on b.id = a.product_id
where a.member_id = #{memberId}
and a.id = #{id}
SELECT
*
FROM
yd_basic_level_setting a
ORDER BY a.id ASC
UPDATE member s
SET s.agent_level = #{levelId}
WHERE
s.id = #{id}
select a.*, c.id p_id, c.pro_unit
from yd_order a
inner join (select * from member a where find_in_set(#{inviteId}, a.referer_ids) or invite_id=#{inviteId}) b on a.member_id=b.id
inner join yd_product c on c.id = a.product_id
where a.type=1
update yd_order
set total_profit=total_profit+#{profit},
today_profit=#{profit}
where id=#{id}
select ifnull(sum(quantity),0) from yd_order where type = 1 and member_id in (
select member_id from member where referer_id = #{inviteId}
)
select a.phone phone,
sum(quantity) powerNum
from member a
left join yd_order b where b.member_id = a.id
where a.referer_id = #{record.inviteId}
and b.type = 1
group by a.member_id
order by a.create_time desc