|
|
|
@ -149,7 +149,9 @@
|
|
|
|
|
<include refid="tradelog_list_keys"/>
|
|
|
|
|
</if>
|
|
|
|
|
FROM pmt_orders o
|
|
|
|
|
INNER JOIN sys_clients p ON p.client_id=o.client_id AND p.is_valid=1
|
|
|
|
|
INNER JOIN sys_clients p
|
|
|
|
|
ON p.client_id = o.client_id
|
|
|
|
|
AND p.is_valid = 1
|
|
|
|
|
<if test="client_ids != null">
|
|
|
|
|
AND p.client_id IN
|
|
|
|
|
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
|
|
|
|
@ -157,72 +159,111 @@
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="client_ids == null and client_id != null">
|
|
|
|
|
and p.client_id=#{client_id}
|
|
|
|
|
AND p.client_id = #{client_id}
|
|
|
|
|
</if>
|
|
|
|
|
LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit'
|
|
|
|
|
LEFT JOIN pmt_transactions t
|
|
|
|
|
ON t.order_id = o.order_id
|
|
|
|
|
AND t.refund_id IS NULL
|
|
|
|
|
AND t.transaction_type = 'Credit'
|
|
|
|
|
<where>
|
|
|
|
|
<if test="search_text != null">
|
|
|
|
|
<bind name="name_pattern" value="'%' + search_text + '%'"/>
|
|
|
|
|
<if test="text_type == 'all'">
|
|
|
|
|
and (p.client_moniker=#{search_text} or p.short_name like #{name_pattern} or o.order_detail like
|
|
|
|
|
#{name_pattern} or t.system_transaction_id =#{search_text} or o.channel = #{search_text} or
|
|
|
|
|
t.order_id =#{search_text})
|
|
|
|
|
AND (
|
|
|
|
|
p.client_moniker = #{search_text}
|
|
|
|
|
OR p.short_name LIKE #{name_pattern}
|
|
|
|
|
OR o.order_detail LIKE #{name_pattern}
|
|
|
|
|
OR t.system_transaction_id = #{search_text}
|
|
|
|
|
OR o.channel = #{search_text}
|
|
|
|
|
OR t.order_id = #{search_text}
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'client_moniker'">
|
|
|
|
|
and p.client_moniker=#{search_text}
|
|
|
|
|
AND p.client_moniker = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'client_name'">
|
|
|
|
|
and p.short_name like #{name_pattern}
|
|
|
|
|
AND p.short_name LIKE #{name_pattern}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'remark'">
|
|
|
|
|
and o.order_detail like #{name_pattern}
|
|
|
|
|
AND o.order_detail LIKE #{name_pattern}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'channel'">
|
|
|
|
|
and o.channel = #{search_text}
|
|
|
|
|
AND o.channel = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'sys_trans_id'">
|
|
|
|
|
and t.system_transaction_id =#{search_text}
|
|
|
|
|
AND t.system_transaction_id = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="text_type == 'order_id'">
|
|
|
|
|
and o.order_id =#{search_text}
|
|
|
|
|
AND o.order_id = #{search_text}
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="order_id!=null">and o.order_id=#{order_id}</if>
|
|
|
|
|
<if test="trade_type!=null">and o.gateway in
|
|
|
|
|
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">#{gateway}</foreach>
|
|
|
|
|
<if test="order_id != null">
|
|
|
|
|
AND o.order_id = #{order_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="org_id!=null and org_ids==null">and p.org_id=#{org_id}</if>
|
|
|
|
|
<if test="org_ids!=null">and p.org_id in
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
|
|
|
|
|
<if test="trade_type != null">
|
|
|
|
|
AND o.gateway IN
|
|
|
|
|
<foreach collection="trade_type" item="gateway" open="(" close=")" separator=",">
|
|
|
|
|
#{gateway}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="org_id != null and org_ids == null">
|
|
|
|
|
AND p.org_id = #{org_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="org_ids != null">
|
|
|
|
|
AND p.org_id IN
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">
|
|
|
|
|
#{org_id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from != null">
|
|
|
|
|
AND o.create_time >= #{from}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="to != null">
|
|
|
|
|
AND o.create_time < #{to}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="date != null">
|
|
|
|
|
AND DATE(o.create_time) = DATE(#{date})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dev_id != null">
|
|
|
|
|
AND o.dev_id = #{dev_id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="from!=null">and o.create_time >= #{from}</if>
|
|
|
|
|
<if test="to!=null">and o.create_time < #{to}</if>
|
|
|
|
|
<if test="date!=null">and date(o.create_time)=date(#{date})</if>
|
|
|
|
|
<if test="dev_id!=null">and o.dev_id=#{dev_id}</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
and
|
|
|
|
|
<foreach collection="status" item="std" open="(" close=")" separator=" or ">o.status=#{std}</foreach>
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="status" item="std" open="(" close=")" separator=" or ">
|
|
|
|
|
o.status = #{std}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="channel != null">
|
|
|
|
|
and
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">o.channel=#{chan}
|
|
|
|
|
AND
|
|
|
|
|
<foreach collection="channel" item="chan" open="(" close=")" separator=" or ">
|
|
|
|
|
o.channel = #{chan}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="bd_group!=null">and p.client_id in
|
|
|
|
|
(SELECT b.client_id FROM sys_client_bd b
|
|
|
|
|
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
|
|
|
|
|
where b.is_valid=1 and b.start_date<=now() and (b.end_date is null or b.end_date >= now())
|
|
|
|
|
<if test="bd_group != null">
|
|
|
|
|
AND p.client_id IN(
|
|
|
|
|
SELECT b.client_id
|
|
|
|
|
FROM sys_client_bd b
|
|
|
|
|
INNER JOIN financial_bd_config c
|
|
|
|
|
ON c.manager_id = b.bd_id
|
|
|
|
|
WHERE b.is_valid = 1
|
|
|
|
|
AND b.start_date <= now()
|
|
|
|
|
AND (b.end_date is null or b.end_date >= now())
|
|
|
|
|
AND (c.bd_group = #{bd_group} or c.manager_id = #{bd_group})
|
|
|
|
|
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
|
|
|
|
|
<if test="bd_group_bd">
|
|
|
|
|
AND c.manager_id = #{bd_group_bd}
|
|
|
|
|
</if>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
GROUP BY o.order_id, t.refund_id
|
|
|
|
|
<if test="bd_user != null">
|
|
|
|
|
) temp
|
|
|
|
|
INNER JOIN sys_client_bd d ON temp.client_id = d.client_id AND d.bd_id = #{bd_user} and d.is_valid=1
|
|
|
|
|
AND date(d.start_date) <= date(now())
|
|
|
|
|
AND (d.end_date is null or date(d.end_date) >= date(now()))
|
|
|
|
|
INNER JOIN sys_client_bd d
|
|
|
|
|
ON temp.client_id = d.client_id
|
|
|
|
|
AND d.bd_id = #{bd_user}
|
|
|
|
|
AND d.is_valid = 1
|
|
|
|
|
AND DATE(d.start_date) <= DATE(now())
|
|
|
|
|
AND (d.end_date IS NULL OR DATE(d.end_date) >= DATE(now()))
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|