|
|
@ -2,13 +2,13 @@
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
<!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">
|
|
|
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientMapper">
|
|
|
|
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listValidClient" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT client_id,client_moniker,parent_client_id FROM sys_clients
|
|
|
|
SELECT client_id, client_moniker, parent_client_id
|
|
|
|
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
|
|
|
|
FROM sys_clients
|
|
|
|
|
|
|
|
WHERE is_valid = 1
|
|
|
|
|
|
|
|
and (approve_result = 1 or approve_result = 2)
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listValidClientFor30Days" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listValidClientFor30Days" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT DISTINCT sc.client_id,
|
|
|
|
DISTINCT
|
|
|
|
|
|
|
|
sc.client_id,
|
|
|
|
|
|
|
|
sc.client_moniker,
|
|
|
|
sc.client_moniker,
|
|
|
|
sc.parent_client_id
|
|
|
|
sc.parent_client_id
|
|
|
|
FROM statistics_customer_order sco,
|
|
|
|
FROM statistics_customer_order sco,
|
|
|
@ -173,7 +173,9 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listLessInfoPartners" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<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
|
|
|
|
FROM sys_clients c
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
inner join sys_client_config cc on cc.client_id = c.client_id
|
|
|
|
inner join sys_org o
|
|
|
|
inner join sys_org o
|
|
|
@ -214,7 +216,8 @@
|
|
|
|
AND c.approve_result = 5 AND c.approve_time is NOT NULL
|
|
|
|
AND c.approve_result = 5 AND c.approve_time is NOT NULL
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="bd_upload_and_completed">
|
|
|
|
<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>
|
|
|
|
<if test="bd_upload_material">
|
|
|
|
<if test="bd_upload_material">
|
|
|
|
AND c.open_status = 3 AND c.approve_result != 5
|
|
|
|
AND c.open_status = 3 AND c.approve_result != 5
|
|
|
@ -359,8 +362,8 @@
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listClientsIdAndMoniker" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listClientsIdAndMoniker" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT client_id,
|
|
|
|
client_id,client_moniker
|
|
|
|
client_moniker
|
|
|
|
from sys_clients
|
|
|
|
from sys_clients
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listPartnerSelection" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listPartnerSelection" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
@ -407,16 +410,15 @@
|
|
|
|
GROUP BY c.contact_email
|
|
|
|
GROUP BY c.contact_email
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT c.client_id,
|
|
|
|
c.client_id,
|
|
|
|
|
|
|
|
c.short_name,
|
|
|
|
c.short_name,
|
|
|
|
c.client_moniker
|
|
|
|
c.client_moniker
|
|
|
|
FROM sys_clients c
|
|
|
|
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>
|
|
|
|
<select id="listClientsForSettlement" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listClientsForSettlement" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT c.client_id,
|
|
|
|
c.client_id,
|
|
|
|
|
|
|
|
c.client_moniker,
|
|
|
|
c.client_moniker,
|
|
|
|
c.short_name,
|
|
|
|
c.short_name,
|
|
|
|
cc.clean_days,
|
|
|
|
cc.clean_days,
|
|
|
@ -427,31 +429,36 @@
|
|
|
|
FROM sys_clients c
|
|
|
|
FROM sys_clients c
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
ORDER BY client_moniker ASC
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listClientsForSettlementWithDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listClientsForSettlementWithDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT c.*,
|
|
|
|
c.*,
|
|
|
|
|
|
|
|
b.bsb_no,
|
|
|
|
b.bsb_no,
|
|
|
|
b.account_no,
|
|
|
|
b.account_no,
|
|
|
|
b.account_name
|
|
|
|
b.account_name
|
|
|
|
FROM sys_clients c
|
|
|
|
FROM sys_clients c
|
|
|
|
INNER JOIN sys_bank_accounts b ON b.client_id = c.client_id
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
ORDER BY client_moniker ASC
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listUnAuthPartners" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listUnAuthPartners" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<![CDATA[
|
|
|
|
<![CDATA[
|
|
|
|
SELECT
|
|
|
|
SELECT client_id,
|
|
|
|
client_id,
|
|
|
|
|
|
|
|
client_moniker,
|
|
|
|
client_moniker,
|
|
|
|
approve_time
|
|
|
|
approve_time
|
|
|
|
FROM sys_clients
|
|
|
|
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>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -481,34 +488,40 @@
|
|
|
|
SELECT DISTINCT cb.client_id
|
|
|
|
SELECT DISTINCT cb.client_id
|
|
|
|
FROM sys_client_bd cb
|
|
|
|
FROM sys_client_bd cb
|
|
|
|
INNER JOIN financial_bd_config bc ON bc.manager_id = cb.bd_id AND bc.city = #{city}
|
|
|
|
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
|
|
|
|
WHERE cb.start_date <= #{date}
|
|
|
|
|
|
|
|
AND cb.is_valid = 1
|
|
|
|
AND (cb.end_date IS NULL OR cb.end_date >= #{date})
|
|
|
|
AND (cb.end_date IS NULL OR cb.end_date >= #{date})
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listClientByCleanDays" resultType="java.lang.String">
|
|
|
|
<select id="listClientByCleanDays" resultType="java.lang.String">
|
|
|
|
SELECT c.client_id FROM sys_clients c
|
|
|
|
SELECT c.client_id
|
|
|
|
|
|
|
|
FROM sys_clients c
|
|
|
|
inner join sys_client_config cc on c.client_id = cc.client_id
|
|
|
|
inner join sys_client_config cc on c.client_id = cc.client_id
|
|
|
|
WHERE c.is_valid = 1 and cc.clean_days = #{clean_days}
|
|
|
|
WHERE c.is_valid = 1
|
|
|
|
|
|
|
|
and cc.clean_days = #{clean_days}
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listSubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listSubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT COUNT(DISTINCT c.client_id) client_count,
|
|
|
|
COUNT(DISTINCT c.client_id) client_count,
|
|
|
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
c.sub_merchant_id,
|
|
|
|
c.merchant_id
|
|
|
|
c.merchant_id
|
|
|
|
FROM sys_clients c
|
|
|
|
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
|
|
|
|
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.merchant_id IS NOT NULL
|
|
|
|
GROUP BY c.sub_merchant_id
|
|
|
|
GROUP BY c.sub_merchant_id
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listBySubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listBySubMerchantId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT c.client_moniker,
|
|
|
|
c.client_moniker,
|
|
|
|
|
|
|
|
c.sub_merchant_id,
|
|
|
|
c.sub_merchant_id,
|
|
|
|
c.merchant_id
|
|
|
|
c.merchant_id
|
|
|
|
FROM sys_clients c
|
|
|
|
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
|
|
|
|
WHERE (c.approve_result = 1 OR c.approve_result = 2)
|
|
|
|
AND c.merchant_id IS NOT NULL AND c.sub_merchant_id = #{sub_merchant_id}
|
|
|
|
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>
|
|
|
|
<select id="simpleQuery" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="simpleQuery" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
select * from sys_clients
|
|
|
|
select * from sys_clients
|
|
|
@ -531,126 +544,112 @@
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="listClientsWithTransactionsSettled" resultType="int">
|
|
|
|
<select id="listClientsWithTransactionsSettled" resultType="int">
|
|
|
|
select distinct c.client_id from sys_clients c
|
|
|
|
select distinct t.client_id
|
|
|
|
inner join pmt_transactions t on t.client_id=c.client_id and t.clearing_status=1 and t.system_generate=0
|
|
|
|
from pmt_transactions t
|
|
|
|
where t.transaction_time between #{from} and #{to}
|
|
|
|
where t.clearing_status = 1
|
|
|
|
|
|
|
|
and t.system_generate = 0
|
|
|
|
|
|
|
|
and t.transaction_time between #{from} and #{to}
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findByhfPayUrlNotNull" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findByrpayNotNull" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countBdApproveClients" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<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
|
|
|
|
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,
|
|
|
|
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((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
|
|
|
|
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
|
|
|
|
FROM sys_clients
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
<bind name="manager_id_pattern" value="'%'+manager_id+'%'"/>
|
|
|
|
<bind name="manager_id_pattern" value="'%'+manager_id+'%'"/>
|
|
|
|
bd_user LIKE #{manager_id_pattern} AND is_valid=1;
|
|
|
|
bd_user LIKE #{manager_id_pattern} AND is_valid=1;
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="createClientsByGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="createClientsByGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT t1.*,
|
|
|
|
t1.*,
|
|
|
|
|
|
|
|
ifnull(t2.clients_yesterday, 0) clients_yesterday
|
|
|
|
ifnull(t2.clients_yesterday, 0) clients_yesterday
|
|
|
|
FROM
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
SELECT fbc.bd_name,
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
fbc.bd_name,
|
|
|
|
|
|
|
|
fbc.bd_group,
|
|
|
|
fbc.bd_group,
|
|
|
|
fbc.bd_type,
|
|
|
|
fbc.bd_type,
|
|
|
|
sum(a.proportion) clients_month
|
|
|
|
sum(a.proportion) clients_month
|
|
|
|
FROM
|
|
|
|
FROM sys_client_bd a
|
|
|
|
sys_client_bd a
|
|
|
|
|
|
|
|
INNER JOIN (
|
|
|
|
INNER JOIN (
|
|
|
|
SELECT
|
|
|
|
SELECT bd_id,
|
|
|
|
bd_id,
|
|
|
|
|
|
|
|
max(create_time) create_time
|
|
|
|
max(create_time) create_time
|
|
|
|
FROM
|
|
|
|
FROM sys_client_bd
|
|
|
|
sys_client_bd
|
|
|
|
WHERE client_id IN (
|
|
|
|
WHERE
|
|
|
|
SELECT client_id
|
|
|
|
client_id IN (
|
|
|
|
FROM sys_clients c
|
|
|
|
SELECT
|
|
|
|
WHERE c.approve_time >= #{start_date_month}
|
|
|
|
client_id
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
|
|
|
sys_clients c
|
|
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
|
|
c.approve_time >= #{start_date_month}
|
|
|
|
|
|
|
|
AND c.approve_time <= #{end_date}
|
|
|
|
AND c.approve_time <= #{end_date}
|
|
|
|
AND c.is_valid = 1
|
|
|
|
AND c.is_valid = 1
|
|
|
|
AND c.approve_result = 1
|
|
|
|
AND c.approve_result = 1
|
|
|
|
AND c.org_id = 1
|
|
|
|
AND c.org_id = 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date_month}
|
|
|
|
AND start_date <= #{end_date}
|
|
|
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
|
|
|
AND (end_date > #{start_date_month}
|
|
|
|
OR end_date IS NULL
|
|
|
|
OR end_date IS NULL
|
|
|
|
)
|
|
|
|
)
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY bd_id,
|
|
|
|
bd_id,
|
|
|
|
|
|
|
|
client_id
|
|
|
|
client_id
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
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 c ON a.bd_id = c.manager_id
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
WHERE
|
|
|
|
WHERE a.is_valid = 1
|
|
|
|
a.is_valid = 1
|
|
|
|
GROUP BY fbc.bd_group
|
|
|
|
GROUP BY
|
|
|
|
ORDER BY clients_month DESC
|
|
|
|
fbc.bd_group
|
|
|
|
|
|
|
|
ORDER BY
|
|
|
|
|
|
|
|
clients_month DESC
|
|
|
|
|
|
|
|
) t1
|
|
|
|
) t1
|
|
|
|
LEFT JOIN (
|
|
|
|
LEFT JOIN (
|
|
|
|
SELECT
|
|
|
|
SELECT fbc.bd_name,
|
|
|
|
fbc.bd_name,
|
|
|
|
|
|
|
|
fbc.bd_group,
|
|
|
|
fbc.bd_group,
|
|
|
|
fbc.bd_type,
|
|
|
|
fbc.bd_type,
|
|
|
|
sum(a.proportion) clients_yesterday
|
|
|
|
sum(a.proportion) clients_yesterday
|
|
|
|
FROM
|
|
|
|
FROM sys_client_bd a
|
|
|
|
sys_client_bd a
|
|
|
|
|
|
|
|
INNER JOIN (
|
|
|
|
INNER JOIN (
|
|
|
|
SELECT
|
|
|
|
SELECT bd_id,
|
|
|
|
bd_id,
|
|
|
|
|
|
|
|
max(create_time) create_time
|
|
|
|
max(create_time) create_time
|
|
|
|
FROM
|
|
|
|
FROM sys_client_bd
|
|
|
|
sys_client_bd
|
|
|
|
WHERE client_id IN (
|
|
|
|
WHERE
|
|
|
|
SELECT client_id
|
|
|
|
client_id IN (
|
|
|
|
FROM sys_clients c
|
|
|
|
SELECT
|
|
|
|
WHERE c.approve_time >= #{start_date}
|
|
|
|
client_id
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
|
|
|
sys_clients c
|
|
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
|
|
c.approve_time >= #{start_date}
|
|
|
|
|
|
|
|
AND c.approve_time < #{end_date}
|
|
|
|
AND c.approve_time < #{end_date}
|
|
|
|
AND c.is_valid = 1
|
|
|
|
AND c.is_valid = 1
|
|
|
|
AND c.approve_result = 1
|
|
|
|
AND c.approve_result = 1
|
|
|
|
AND c.org_id = 1
|
|
|
|
AND c.org_id = 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
AND start_date <= #{end_date} AND is_valid = 1 AND ( end_date > #{start_date}
|
|
|
|
AND start_date <= #{end_date}
|
|
|
|
|
|
|
|
AND is_valid = 1
|
|
|
|
|
|
|
|
AND (end_date > #{start_date}
|
|
|
|
OR end_date IS NULL
|
|
|
|
OR end_date IS NULL
|
|
|
|
)
|
|
|
|
)
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY bd_id,
|
|
|
|
bd_id,
|
|
|
|
|
|
|
|
client_id
|
|
|
|
client_id
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
) b ON a.bd_id = b.bd_id
|
|
|
|
AND a.create_time = b.create_time
|
|
|
|
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 c ON a.bd_id = c.manager_id
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
|
|
|
|
WHERE
|
|
|
|
WHERE a.is_valid = 1
|
|
|
|
a.is_valid = 1
|
|
|
|
GROUP BY fbc.bd_group
|
|
|
|
GROUP BY
|
|
|
|
ORDER BY clients_yesterday DESC
|
|
|
|
fbc.bd_group
|
|
|
|
|
|
|
|
ORDER BY
|
|
|
|
|
|
|
|
clients_yesterday DESC
|
|
|
|
|
|
|
|
) t2 ON t1.bd_group = t2.bd_group
|
|
|
|
) t2 ON t1.bd_group = t2.bd_group
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="clientPayTypeInfoByClientIdRange" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<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
|
|
|
|
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
|
|
|
|
INNER JOIN sys_client_config c ON c.client_id = p.client_id
|
|
|
|
WHERE p.is_valid = 1
|
|
|
|
WHERE p.is_valid = 1
|
|
|
|
AND p.client_id >= #{begin}
|
|
|
|
AND p.client_id >= #{begin}
|
|
|
@ -658,7 +657,9 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getPartnercode" resultType="int">
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listNeedOpenCbpayMerchant" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listNeedOpenCbpayMerchant" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
@ -675,27 +676,19 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findCountByBd" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="findCountByBd" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT *
|
|
|
|
*
|
|
|
|
FROM (
|
|
|
|
FROM
|
|
|
|
SELECT count(*) yesterday_count
|
|
|
|
(
|
|
|
|
FROM sys_clients
|
|
|
|
SELECT
|
|
|
|
WHERE creator = #{bd_group}
|
|
|
|
count( * ) yesterday_count
|
|
|
|
|
|
|
|
FROM
|
|
|
|
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
|
|
creator = #{bd_group}
|
|
|
|
|
|
|
|
AND create_time >= #{yesterday}
|
|
|
|
AND create_time >= #{yesterday}
|
|
|
|
AND create_time < #{today}
|
|
|
|
AND create_time < #{today}
|
|
|
|
AND is_valid = 1
|
|
|
|
AND is_valid = 1
|
|
|
|
) a,
|
|
|
|
) a,
|
|
|
|
(
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
SELECT count(*) month_count
|
|
|
|
count( * ) month_count
|
|
|
|
FROM sys_clients
|
|
|
|
FROM
|
|
|
|
WHERE creator = #{bd_group}
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
|
|
creator = #{bd_group}
|
|
|
|
|
|
|
|
AND create_time >= #{month}
|
|
|
|
AND create_time >= #{month}
|
|
|
|
AND create_time < #{today}
|
|
|
|
AND create_time < #{today}
|
|
|
|
AND is_valid = 1
|
|
|
|
AND is_valid = 1
|
|
|
@ -703,54 +696,46 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findSamePhone" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="findSamePhone" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT contact_phone,
|
|
|
|
contact_phone,
|
|
|
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
FROM
|
|
|
|
FROM sys_clients
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE contact_phone = #{contact_phone}
|
|
|
|
WHERE contact_phone = #{contact_phone}
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY contact_phone
|
|
|
|
contact_phone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findSameCompanyName" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="findSameCompanyName" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT company_name,
|
|
|
|
company_name,
|
|
|
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
FROM
|
|
|
|
FROM sys_clients
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE company_name = #{company_name}
|
|
|
|
WHERE company_name = #{company_name}
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY company_name
|
|
|
|
company_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findSameEmail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="findSameEmail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT contact_email,
|
|
|
|
contact_email,
|
|
|
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
FROM
|
|
|
|
FROM sys_clients
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE contact_email = #{contact_email}
|
|
|
|
WHERE contact_email = #{contact_email}
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY contact_email
|
|
|
|
contact_email
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findSameAddress" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="findSameAddress" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT
|
|
|
|
SELECT address,
|
|
|
|
address,
|
|
|
|
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
GROUP_CONCAT(client_moniker separator ' ') a
|
|
|
|
FROM
|
|
|
|
FROM sys_clients
|
|
|
|
sys_clients
|
|
|
|
|
|
|
|
WHERE address = #{address}
|
|
|
|
WHERE address = #{address}
|
|
|
|
GROUP BY
|
|
|
|
GROUP BY address
|
|
|
|
address
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listUseAlipayMerchant" resultType="int">
|
|
|
|
<select id="listUseAlipayMerchant" resultType="int">
|
|
|
|
select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1
|
|
|
|
select client_id
|
|
|
|
and client_id >=#{start} and client_id <#{end}
|
|
|
|
from sys_clients
|
|
|
|
|
|
|
|
where gateway_alipay_online = 1
|
|
|
|
|
|
|
|
and is_valid = 1
|
|
|
|
|
|
|
|
and client_id >= #{start}
|
|
|
|
|
|
|
|
and client_id < #{end}
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
</mapper>
|
|
|
|
</mapper>
|
|
|
|