|
|
|
@ -2,19 +2,19 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientMapper">
|
|
|
|
|
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT client_id,client_moniker,parent_client_id FROM sys_clients
|
|
|
|
|
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
|
|
|
|
|
SELECT client_id, client_moniker, parent_client_id
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE is_valid = 1
|
|
|
|
|
and (approve_result = 1 or approve_result = 2)
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listValidClientFor30Days" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
DISTINCT
|
|
|
|
|
sc.client_id,
|
|
|
|
|
sc.client_moniker,
|
|
|
|
|
sc.parent_client_id
|
|
|
|
|
SELECT DISTINCT sc.client_id,
|
|
|
|
|
sc.client_moniker,
|
|
|
|
|
sc.parent_client_id
|
|
|
|
|
FROM statistics_customer_order sco,
|
|
|
|
|
sys_clients sc
|
|
|
|
|
sys_clients sc
|
|
|
|
|
WHERE sco.date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
|
|
|
|
|
AND sco.client_id = sc.client_id
|
|
|
|
|
AND sco.client_id = sc.client_id
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker
|
|
|
|
@ -173,7 +173,9 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listLessInfoPartners" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT DISTINCT c.client_moniker,c.source,c.approve_result,c.short_name,c.company_phone,c.approve_time,c.create_time,c.open_status,c.address,c.state,c.suburb,c.is_valid,c.postcode,c.country,o.name org_name
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
c.client_moniker,c.source,c.approve_result,c.short_name,c.company_phone,c.approve_time,c.create_time,c.open_status,c.address,c.state,c.suburb,c.is_valid,c.postcode,c.country,o.name
|
|
|
|
|
org_name
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
|
inner join sys_org o
|
|
|
|
@ -214,7 +216,8 @@
|
|
|
|
|
AND c.approve_result = 5 AND c.approve_time is NOT NULL
|
|
|
|
|
</if>
|
|
|
|
|
<if test="bd_upload_and_completed">
|
|
|
|
|
AND ((c.open_status = 3 AND c.approve_result != 5 ) OR (c.open_status IS NULL AND c.approve_result IS NULL AND c.source != 4))
|
|
|
|
|
AND ((c.open_status = 3 AND c.approve_result != 5 ) OR (c.open_status IS NULL AND c.approve_result IS
|
|
|
|
|
NULL AND c.source != 4))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="bd_upload_material">
|
|
|
|
|
AND c.open_status = 3 AND c.approve_result != 5
|
|
|
|
@ -359,8 +362,8 @@
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClientsIdAndMoniker" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
client_id,client_moniker
|
|
|
|
|
SELECT client_id,
|
|
|
|
|
client_moniker
|
|
|
|
|
from sys_clients
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listPartnerSelection" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
@ -407,51 +410,55 @@
|
|
|
|
|
GROUP BY c.contact_email
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
c.client_id,
|
|
|
|
|
c.short_name,
|
|
|
|
|
c.client_moniker
|
|
|
|
|
SELECT c.client_id,
|
|
|
|
|
c.short_name,
|
|
|
|
|
c.client_moniker
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result = 2)
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClientsForSettlement" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
c.client_id,
|
|
|
|
|
c.client_moniker,
|
|
|
|
|
c.short_name,
|
|
|
|
|
cc.clean_days,
|
|
|
|
|
cc.weekend_delay,
|
|
|
|
|
b.bsb_no,
|
|
|
|
|
b.account_no,
|
|
|
|
|
b.account_name
|
|
|
|
|
SELECT c.client_id,
|
|
|
|
|
c.client_moniker,
|
|
|
|
|
c.short_name,
|
|
|
|
|
cc.clean_days,
|
|
|
|
|
cc.weekend_delay,
|
|
|
|
|
b.bsb_no,
|
|
|
|
|
b.account_no,
|
|
|
|
|
b.account_name
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
|
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND cc.is_valid = 1
|
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
|
WHERE cc.skip_clearing = 0
|
|
|
|
|
AND (c.approve_result = 1 or (c.approve_result = 2 and (c.source = 1 or c.source = 2)))
|
|
|
|
|
AND cc.is_valid = 1
|
|
|
|
|
ORDER BY client_moniker ASC
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClientsForSettlementWithDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
c.*,
|
|
|
|
|
b.bsb_no,
|
|
|
|
|
b.account_no,
|
|
|
|
|
b.account_name
|
|
|
|
|
SELECT c.*,
|
|
|
|
|
b.bsb_no,
|
|
|
|
|
b.account_no,
|
|
|
|
|
b.account_name
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
|
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2))) AND cc.is_valid = 1
|
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
|
WHERE cc.skip_clearing = 0
|
|
|
|
|
AND (c.approve_result = 1 or (c.approve_result = 2 and (c.source = 1 or c.source = 2)))
|
|
|
|
|
AND cc.is_valid = 1
|
|
|
|
|
ORDER BY client_moniker ASC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listUnAuthPartners" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
client_id,
|
|
|
|
|
client_moniker,
|
|
|
|
|
approve_time
|
|
|
|
|
SELECT client_id,
|
|
|
|
|
client_moniker,
|
|
|
|
|
approve_time
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE is_valid = 1 AND approve_result = 2 AND source = 4 AND datediff(now(), approve_time) <= #{auth_days}
|
|
|
|
|
WHERE is_valid = 1
|
|
|
|
|
AND approve_result = 2
|
|
|
|
|
AND source = 4
|
|
|
|
|
AND datediff(now(), approve_time) <= #{auth_days}
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -480,35 +487,41 @@
|
|
|
|
|
<select id="listCityClientIds" resultType="java.lang.String">
|
|
|
|
|
SELECT DISTINCT cb.client_id
|
|
|
|
|
FROM sys_client_bd cb
|
|
|
|
|
INNER JOIN financial_bd_config bc ON bc.manager_id = cb.bd_id AND bc.city = #{city}
|
|
|
|
|
WHERE cb.start_date <= #{date} AND cb.is_valid = 1
|
|
|
|
|
AND (cb.end_date IS NULL OR cb.end_date >= #{date})
|
|
|
|
|
INNER JOIN financial_bd_config bc ON bc.manager_id = cb.bd_id AND bc.city = #{city}
|
|
|
|
|
WHERE cb.start_date <= #{date}
|
|
|
|
|
AND cb.is_valid = 1
|
|
|
|
|
AND (cb.end_date IS NULL OR cb.end_date >= #{date})
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClientByCleanDays" resultType="java.lang.String">
|
|
|
|
|
SELECT c.client_id FROM sys_clients c
|
|
|
|
|
inner join sys_client_config cc on c.client_id = cc.client_id
|
|
|
|
|
WHERE c.is_valid = 1 and cc.clean_days = #{clean_days}
|
|
|
|
|
SELECT c.client_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
inner join sys_client_config cc on c.client_id = cc.client_id
|
|
|
|
|
WHERE c.is_valid = 1
|
|
|
|
|
and cc.clean_days = #{clean_days}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listSubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT(DISTINCT c.client_id) client_count,
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
|
c.merchant_id
|
|
|
|
|
SELECT COUNT(DISTINCT c.client_id) client_count,
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
|
c.merchant_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 AND c.sub_merchant_id IS NOT NULL
|
|
|
|
|
AND c.merchant_id IS NOT NULL
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result = 2)
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.sub_merchant_id IS NOT NULL
|
|
|
|
|
AND c.merchant_id IS NOT NULL
|
|
|
|
|
GROUP BY c.sub_merchant_id
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listBySubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
c.client_moniker,
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
|
c.merchant_id
|
|
|
|
|
SELECT c.client_moniker,
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
|
c.merchant_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 AND c.sub_merchant_id IS NOT NULL
|
|
|
|
|
AND c.merchant_id IS NOT NULL AND c.sub_merchant_id = #{sub_merchant_id}
|
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result = 2)
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.sub_merchant_id IS NOT NULL
|
|
|
|
|
AND c.merchant_id IS NOT NULL
|
|
|
|
|
AND c.sub_merchant_id = #{sub_merchant_id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="simpleQuery" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select * from sys_clients
|
|
|
|
@ -531,134 +544,122 @@
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listClientsWithTransactionsSettled" resultType="int">
|
|
|
|
|
select distinct c.client_id from sys_clients c
|
|
|
|
|
inner join pmt_transactions t on t.client_id=c.client_id and t.clearing_status=1 and t.system_generate=0
|
|
|
|
|
where t.transaction_time between #{from} and #{to}
|
|
|
|
|
select distinct t.client_id
|
|
|
|
|
from pmt_transactions t
|
|
|
|
|
where t.clearing_status = 1
|
|
|
|
|
and t.system_generate = 0
|
|
|
|
|
and t.transaction_time between #{from} and #{to}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findByhfPayUrlNotNull" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select client_id,client_moniker FROM sys_clients WHERE hf_pay_url != ''
|
|
|
|
|
select client_id, client_moniker
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE hf_pay_url != ''
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findByrpayNotNull" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select * FROM sys_clients WHERE rpay_enterprise_id != ''
|
|
|
|
|
select *
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE rpay_enterprise_id != ''
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="countBdApproveClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT SUM(IF(((approve_result=4 AND open_status IS NULL) OR (approve_result=3 AND open_status IS NULL) OR
|
|
|
|
|
open_status=1 OR open_status=2 OR open_status=4),1,0)) approving,
|
|
|
|
|
SUM(IF((open_status = 5 AND approve_result = 1 AND approve_time IS NOT NULL),1,0)) pass,
|
|
|
|
|
SUM(IF((YEAR(approve_time)=YEAR(now()) and MONTH(approve_time)=MONTH(now()) AND approve_result = 1 AND open_status = 5),1,0)) this_months_pass
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
open_status=1 OR open_status=2 OR open_status=4),1,0)) approving,
|
|
|
|
|
SUM(IF((open_status = 5 AND approve_result = 1 AND approve_time IS NOT NULL),1,0)) pass,
|
|
|
|
|
SUM(IF((YEAR(approve_time)=YEAR(now()) and MONTH(approve_time)=MONTH(now()) AND approve_result = 1 AND
|
|
|
|
|
open_status = 5),1,0)) this_months_pass
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE
|
|
|
|
|
<bind name="manager_id_pattern" value="'%'+manager_id+'%'"/>
|
|
|
|
|
bd_user LIKE #{manager_id_pattern} AND is_valid=1;
|
|
|
|
|
</select>
|
|
|
|
|
<select id="createClientsByGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.*,
|
|
|
|
|
ifnull( t2.clients_yesterday, 0 ) clients_yesterday
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
fbc.bd_name,
|
|
|
|
|
fbc.bd_group,
|
|
|
|
|
fbc.bd_type,
|
|
|
|
|
sum( a.proportion ) clients_month
|
|
|
|
|
FROM
|
|
|
|
|
sys_client_bd a
|
|
|
|
|
INNER JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
bd_id,
|
|
|
|
|
max( create_time ) create_time
|
|
|
|
|
FROM
|
|
|
|
|
sys_client_bd
|
|
|
|
|
WHERE
|
|
|
|
|
client_id IN (
|
|
|
|
|
SELECT
|
|
|
|
|
client_id
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients c
|
|
|
|
|
WHERE
|
|
|
|
|
c.approve_time >= #{start_date_month}
|
|
|
|
|
AND c.approve_time <= #{end_date}
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.approve_result = 1
|
|
|
|
|
AND c.org_id = 1
|
|
|
|
|
)
|
|
|
|
|
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date_month}
|
|
|
|
|
OR end_date IS NULL
|
|
|
|
|
)
|
|
|
|
|
GROUP BY
|
|
|
|
|
bd_id,
|
|
|
|
|
client_id
|
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
|
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
|
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
|
WHERE
|
|
|
|
|
a.is_valid = 1
|
|
|
|
|
GROUP BY
|
|
|
|
|
fbc.bd_group
|
|
|
|
|
ORDER BY
|
|
|
|
|
clients_month DESC
|
|
|
|
|
) t1
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
fbc.bd_name,
|
|
|
|
|
fbc.bd_group,
|
|
|
|
|
fbc.bd_type,
|
|
|
|
|
sum( a.proportion ) clients_yesterday
|
|
|
|
|
FROM
|
|
|
|
|
sys_client_bd a
|
|
|
|
|
INNER JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
bd_id,
|
|
|
|
|
max( create_time ) create_time
|
|
|
|
|
FROM
|
|
|
|
|
sys_client_bd
|
|
|
|
|
WHERE
|
|
|
|
|
client_id IN (
|
|
|
|
|
SELECT
|
|
|
|
|
client_id
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients c
|
|
|
|
|
WHERE
|
|
|
|
|
c.approve_time >= #{start_date}
|
|
|
|
|
AND c.approve_time < #{end_date}
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.approve_result = 1
|
|
|
|
|
AND c.org_id = 1
|
|
|
|
|
)
|
|
|
|
|
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date}
|
|
|
|
|
OR end_date IS NULL
|
|
|
|
|
)
|
|
|
|
|
GROUP BY
|
|
|
|
|
bd_id,
|
|
|
|
|
client_id
|
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
|
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
|
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
|
WHERE
|
|
|
|
|
a.is_valid = 1
|
|
|
|
|
GROUP BY
|
|
|
|
|
fbc.bd_group
|
|
|
|
|
ORDER BY
|
|
|
|
|
clients_yesterday DESC
|
|
|
|
|
SELECT t1.*,
|
|
|
|
|
ifnull(t2.clients_yesterday, 0) clients_yesterday
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT fbc.bd_name,
|
|
|
|
|
fbc.bd_group,
|
|
|
|
|
fbc.bd_type,
|
|
|
|
|
sum(a.proportion) clients_month
|
|
|
|
|
FROM sys_client_bd a
|
|
|
|
|
INNER JOIN (
|
|
|
|
|
SELECT bd_id,
|
|
|
|
|
max(create_time) create_time
|
|
|
|
|
FROM sys_client_bd
|
|
|
|
|
WHERE client_id IN (
|
|
|
|
|
SELECT client_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
WHERE c.approve_time >= #{start_date_month}
|
|
|
|
|
AND c.approve_time <= #{end_date}
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.approve_result = 1
|
|
|
|
|
AND c.org_id = 1
|
|
|
|
|
)
|
|
|
|
|
AND start_date <= #{end_date}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
AND (end_date > #{start_date_month}
|
|
|
|
|
OR end_date IS NULL
|
|
|
|
|
)
|
|
|
|
|
GROUP BY bd_id,
|
|
|
|
|
client_id
|
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
|
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
|
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
|
WHERE a.is_valid = 1
|
|
|
|
|
GROUP BY fbc.bd_group
|
|
|
|
|
ORDER BY clients_month DESC
|
|
|
|
|
) t1
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT fbc.bd_name,
|
|
|
|
|
fbc.bd_group,
|
|
|
|
|
fbc.bd_type,
|
|
|
|
|
sum(a.proportion) clients_yesterday
|
|
|
|
|
FROM sys_client_bd a
|
|
|
|
|
INNER JOIN (
|
|
|
|
|
SELECT bd_id,
|
|
|
|
|
max(create_time) create_time
|
|
|
|
|
FROM sys_client_bd
|
|
|
|
|
WHERE client_id IN (
|
|
|
|
|
SELECT client_id
|
|
|
|
|
FROM sys_clients c
|
|
|
|
|
WHERE c.approve_time >= #{start_date}
|
|
|
|
|
AND c.approve_time < #{end_date}
|
|
|
|
|
AND c.is_valid = 1
|
|
|
|
|
AND c.approve_result = 1
|
|
|
|
|
AND c.org_id = 1
|
|
|
|
|
)
|
|
|
|
|
AND start_date <= #{end_date}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
AND (end_date > #{start_date}
|
|
|
|
|
OR end_date IS NULL
|
|
|
|
|
)
|
|
|
|
|
GROUP BY bd_id,
|
|
|
|
|
client_id
|
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
|
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
|
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
|
WHERE a.is_valid = 1
|
|
|
|
|
GROUP BY fbc.bd_group
|
|
|
|
|
ORDER BY clients_yesterday DESC
|
|
|
|
|
) t2 ON t1.bd_group = t2.bd_group
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="clientPayTypeInfoByClientIdRange" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT p.client_id,p.client_moniker,c.client_pay_type,c.client_pay_desc FROM sys_clients p
|
|
|
|
|
INNER JOIN sys_client_config c ON c.client_id=p.client_id
|
|
|
|
|
WHERE p.is_valid=1
|
|
|
|
|
AND p.client_id >= #{begin}
|
|
|
|
|
AND p.client_id < #{end}
|
|
|
|
|
SELECT p.client_id, p.client_moniker, c.client_pay_type, c.client_pay_desc
|
|
|
|
|
FROM sys_clients p
|
|
|
|
|
INNER JOIN sys_client_config c ON c.client_id = p.client_id
|
|
|
|
|
WHERE p.is_valid = 1
|
|
|
|
|
AND p.client_id >= #{begin}
|
|
|
|
|
AND p.client_id < #{end}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPartnercode" resultType="int">
|
|
|
|
|
SELECT count(1) FROM sys_clients where client_moniker=#{codes};
|
|
|
|
|
SELECT count(1)
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
where client_moniker = #{codes};
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listNeedOpenCbpayMerchant" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
@ -675,82 +676,66 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findCountByBd" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
count( * ) yesterday_count
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE
|
|
|
|
|
creator = #{bd_group}
|
|
|
|
|
AND create_time >= #{yesterday}
|
|
|
|
|
AND create_time < #{today}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
) a,
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
count( * ) month_count
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE
|
|
|
|
|
creator = #{bd_group}
|
|
|
|
|
AND create_time >= #{month}
|
|
|
|
|
AND create_time < #{today}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
) b
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT count(*) yesterday_count
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE creator = #{bd_group}
|
|
|
|
|
AND create_time >= #{yesterday}
|
|
|
|
|
AND create_time < #{today}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
) a,
|
|
|
|
|
(
|
|
|
|
|
SELECT count(*) month_count
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE creator = #{bd_group}
|
|
|
|
|
AND create_time >= #{month}
|
|
|
|
|
AND create_time < #{today}
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
) b
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findSamePhone" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
contact_phone,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE contact_phone= #{contact_phone}
|
|
|
|
|
GROUP BY
|
|
|
|
|
contact_phone
|
|
|
|
|
SELECT contact_phone,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE contact_phone = #{contact_phone}
|
|
|
|
|
GROUP BY contact_phone
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findSameCompanyName" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
company_name,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE company_name= #{company_name}
|
|
|
|
|
GROUP BY
|
|
|
|
|
company_name
|
|
|
|
|
SELECT company_name,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE company_name = #{company_name}
|
|
|
|
|
GROUP BY company_name
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findSameEmail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
contact_email,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE contact_email= #{contact_email}
|
|
|
|
|
GROUP BY
|
|
|
|
|
contact_email
|
|
|
|
|
SELECT contact_email,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE contact_email = #{contact_email}
|
|
|
|
|
GROUP BY contact_email
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findSameAddress" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT
|
|
|
|
|
address,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM
|
|
|
|
|
sys_clients
|
|
|
|
|
WHERE address= #{address}
|
|
|
|
|
GROUP BY
|
|
|
|
|
address
|
|
|
|
|
SELECT address,
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
|
FROM sys_clients
|
|
|
|
|
WHERE address = #{address}
|
|
|
|
|
GROUP BY address
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listUseAlipayMerchant" resultType="int">
|
|
|
|
|
select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1
|
|
|
|
|
and client_id >=#{start} and client_id <#{end}
|
|
|
|
|
select client_id
|
|
|
|
|
from sys_clients
|
|
|
|
|
where gateway_alipay_online = 1
|
|
|
|
|
and is_valid = 1
|
|
|
|
|
and client_id >= #{start}
|
|
|
|
|
and client_id < #{end}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|
|
|
|
|