select * from otc_order
where status in (1,2) and member_id=#{memberId} and entrust_order_id=#{entrustOrderId}
select
a.id,
a.order_no orderNo,
a.unit_price unitPrice,
a.coin_amount amount,
a.status status,
a.total_amount totalAmount,
a.create_time creatTime,
a.order_type orderType,
b.name name
from otc_order a
inner join member b on a.opposite_member_id=b.id
and a.status in (1, 2)
and a.status = 3
and a.status = 4
and a.member_id = ${record.memberId}
order by a.create_time desc
update otc_order
set status=#{status}
, pay_name = #{payName}
where order_no=#{orderNo}
select * from otc_order
where order_no=#{orderNo} and order_type=#{orderType}
select * from otc_order
where order_type=#{type} and status=#{status}
select count(distinct member_id) from otc_order
where entrust_member_id=#{entrustMemberId} and status != 4 and entrust_member_id!=member_id
select count(1) from otc_order
where member_id=#{entrustMemberId}
and status = #{status}
and order_type = #{type}
select
IFNULL(sum(timestampdiff(SECOND, create_time, pay_time))/count(1), 0)
from otc_order
where status=3 and member_id=#{memberId} and order_type='B'
select
IFNULL(sum(timestampdiff(SECOND, pay_time, finish_time))/count(1), 0)
from otc_order
where status=3 and member_id=40 and order_type='S'
select * from otc_order
where member_id=#{memberId}
and status = #{status}
select IFNULL(sum(total_amount), 0) from otc_order
where member_id=#{memberId} and status = 3
select
order_no orderNo,
member_id memberId,
unit_price unitPrice,
coin_amount usdtAmount,
total_amount totalAmount,
status status,
order_type orderType
from otc_order
where ((member_id=#{memberId} and opposite_member_id=#{targetId})
or
(member_id=#{targetId} and opposite_member_id=#{memberId}))
and status in (1,2)
order by create_time desc
select
order_no orderNo,
member_id memberId,
unit_price unitPrice,
coin_amount usdtAmount,
total_amount totalAmount,
status status,
order_type orderType
from otc_order
where ((member_id=#{memberId} and opposite_member_id=#{targetId})
or
(member_id=#{targetId} and opposite_member_id=#{memberId}))
order by create_time desc
LIMIT 2
update otc_order
set is_return=#{isReturn}
where order_no=#{orderNo}
select * from otc_order
where order_no=#{orderNo} and member_id!=entrust_member_id