@ -10,7 +10,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
</select>
</select>
<select id= "countNewClientsHistory" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "countNewClientsHistory" resultType= "com.alibaba.fastjson.JSONObject" >
@ -20,16 +21,17 @@
right join calendar a on a.datelist = date(c.create_time)
right join calendar a on a.datelist = date(c.create_time)
]]>
]]>
<!-- <if test="city!=null"> -->
<!-- <if test="city!=null"> -->
<!-- INNER JOIN sys_client_bd b on b.client_id=c.client_id and b.start_date<=curdate() -->
<!-- INNER JOIN sys_client_bd b on b.client_id=c.client_id and b.start_date<=curdate() -->
<!-- AND (b.end_date is null or b.end_date>=curdate()) -->
<!-- AND (b.end_date is null or b.end_date>=curdate()) -->
<!-- inner join financial_bd_config bc on bc.manager_id=b.bd_id and bc.city=#{city} -->
<!-- inner join financial_bd_config bc on bc.manager_id=b.bd_id and bc.city=#{city} -->
<!-- </if> -->
<!-- </if> -->
< ![CDATA[
< ![CDATA[
where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1
where a.datelist>= #{begin} AND a.datelist< #{end} AND c.is_valid=1
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and c.org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and c.org_id=#{org_id}</if>
<if test= "org_ids!=null" > and c.org_id in
<if test= "org_ids!=null" > and c.org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
<if test= "bd_group!=null" > and c.client_id in
<if test= "bd_group!=null" > and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -50,7 +52,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
</select>
</select>
<!-- 显示所有的商户,包括禁用的 -->
<!-- 显示所有的商户,包括禁用的 -->
@ -77,7 +80,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
GROUP BY YEAR(create_time),MONTH(create_time),DAY(create_time) ORDER BY create_time desc
GROUP BY YEAR(create_time),MONTH(create_time),DAY(create_time) ORDER BY create_time desc
</select>
</select>
@ -90,7 +94,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
</select>
</select>
<select id= "countTradedPartners" resultType= "java.lang.Integer" >
<select id= "countTradedPartners" resultType= "java.lang.Integer" >
< ![CDATA[
< ![CDATA[
@ -101,7 +106,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and p.org_id=#{org_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
<if test= "org_ids!=null" > and p.org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
</select>
</select>
<select id= "countTradePartnersHistory" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "countTradePartnersHistory" resultType= "com.alibaba.fastjson.JSONObject" >
@ -113,7 +119,8 @@
]]>
]]>
<if test= "org_id!=null and org_ids==null" > and p.org_id=#{org_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
<if test= "org_ids!=null" > and p.org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
<if test= "bd_group!=null" > and p.client_id in
<if test= "bd_group!=null" > and p.client_id in
(SELECT b.client_id FROM sys_client_bd b
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -206,17 +213,17 @@
</if>
</if>
<if test= "bd_group != null" >
<if test= "bd_group != null" >
AND p.client_id IN (
AND p.client_id IN (
SELECT b.client_id
SELECT b.client_id
FROM sys_client_bd b
FROM sys_client_bd b
INNER JOIN financial_bd_config c
INNER JOIN financial_bd_config c
ON c.manager_id = b.bd_id
ON c.manager_id = b.bd_id
WHERE b.is_valid = 1
WHERE b.is_valid = 1
AND b.start_date < = now()
AND b.start_date < = now()
AND (b.end_date IS NULL OR b.end_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})
AND (c.bd_group = #{bd_group} OR c.manager_id = #{bd_group})
<if test= "bd_group_bd" >
<if test= "bd_group_bd" >
AND c.manager_id = #{bd_group_bd}
AND c.manager_id = #{bd_group_bd}
</if>
</if>
)
)
</if>
</if>
GROUP BY p.client_id
GROUP BY p.client_id
@ -229,8 +236,8 @@
</select>
</select>
<select id= "countClientsTypes" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "countClientsTypes" resultType= "com.alibaba.fastjson.JSONObject" >
SELECT c.industry,c.royalpayindustry,count(1) partner_counts FROM sys_clients c
SELECT c.industry,c.royalpayindustry,count(1) partner_counts FROM sys_clients c
<if test= "bd_user!=null" >
<if test= "bd_user!=null" >
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)< = date(now()) and (d.end_date is null or date(d.end_date)> = date(now())) and
date(d.start_date)< = date(now()) and (d.end_date is null or date(d.end_date)> = date(now())) and
d.is_valid=1
d.is_valid=1
@ -239,7 +246,8 @@
is_valid = 1 and industry < '400' AND approve_result=1
is_valid = 1 and industry < '400' AND approve_result=1
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
</if>
<if test= "bd_group!=null" > and c.client_id in
<if test= "bd_group!=null" > and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
@ -249,79 +257,86 @@
)
)
</if>
</if>
</where>
</where>
GROUP BY c.royalpayindustry order by partner_counts desc
GROUP BY c.royalpayindustry order by partner_counts desc
</select>
</select>
<select id= "notTradeSubMerchantId" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "notTradeSubMerchantId" resultType= "com.alibaba.fastjson.JSONObject" >
< ![CDATA[
< ![CDATA[
SELECT COUNT(DISTINCT c.client_id) client_count,
c.sub_merchant_id,
SELECT COUNT(DISTINCT c.client_id) client_count,
c.merchant_id
c.sub_merchant_id,
FROM sys_clients c
c.merchant_id
WHERE c.sub_merchant_id not in
FROM sys_clients c
(SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
WHERE c.sub_merchant_id not in
WHERE datediff(now(), o.create_time) < = 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
(SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
WHERE datediff(now(), o.create_time) < = 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND c.enable_wechat = 1
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
]]>
AND c.enable_wechat = 1
GROUP by c.sub_merchant_id
]]>
</select>
GROUP by c.sub_merchant_id
</select>
<select id= "tradeSubMerchantIdBy60Days" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "tradeSubMerchantIdBy60Days" resultType= "com.alibaba.fastjson.JSONObject" >
< ![CDATA[
< ![CDATA[
SELECT COUNT(DISTINCT c.client_id) client_count,
c.sub_merchant_id,
SELECT COUNT(DISTINCT c.client_id) client_count,
c.merchant_id,
c.sub_merchant_id,
tmp.create_time last_trade_time,
c.merchant_id,
datediff(now(), tmp.create_time) diff_days
tmp.create_time last_trade_time,
FROM sys_clients c INNER JOIN (SELECT sub_merchant_id, max(create_time) create_time
datediff(now(), tmp.create_time) diff_days
FROM pmt_orders where status>=5 and create_time>=#{begin} and create_time< =now()
FROM sys_clients c INNER JOIN (SELECT sub_merchant_id, max(create_time) create_time
and channel='Wechat'
FROM pmt_orders where status>=5 and create_time>=#{begin} and create_time< =now()
GROUP BY sub_merchant_id
and channel='Wechat'
) tmp on c.sub_merchant_id = tmp.sub_merchant_id
GROUP BY sub_merchant_id
WHERE
) tmp on c.sub_merchant_id = tmp.sub_merchant_id
c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
WHERE
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL
AND c.enable_wechat = 1
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
]]>
AND c.enable_wechat = 1
GROUP BY c.sub_merchant_id ORDER BY diff_days desc
]]>
</select>
GROUP BY c.sub_merchant_id ORDER BY diff_days desc
</select>
<select id= "countClientsSettlementCycle" resultType= "com.alibaba.fastjson.JSONObject" >
<select id= "countClientsSettlementCycle" resultType= "com.alibaba.fastjson.JSONObject" >
SELECT COUNT(DISTINCT c.client_id) client_count,
SELECT COUNT(DISTINCT c.client_id) client_count,
CASE c.clean_days
CASE c.clean_days
WHEN 1
WHEN 1
THEN 'T+1'
THEN 'T+1'
WHEN 2
WHEN 2
THEN 'T+2'
THEN 'T+2'
WHEN 3
WHEN 3
THEN 'T+3'
THEN 'T+3'
END AS clean_days
END AS clean_days
FROM sys_clients c
FROM sys_clients c
<where >
<where >
(c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
(c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_id!=null and org_ids==null" > and org_id=#{org_id}</if>
<if test= "org_ids!=null" > and org_id in
<if test= "org_ids!=null" > and org_id in
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach> </if>
<foreach collection= "org_ids" item= "org_id" open= "(" close= ")" separator= "," > #{org_id}</foreach>
<if test= "bd_group!=null" > and c.client_id in
</if>
(SELECT b.client_id FROM sys_client_bd b
<if test= "bd_group!=null" > and c.client_id in
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
(SELECT b.client_id FROM sys_client_bd b
where b.is_valid=1 and b.start_date< =now() and (b.end_date is null or b.end_date > = now())
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
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_bd" > and c.manager_id=#{bd_group_bd}</if> )
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
</if>
<if test= "bd_group_bd" > and c.manager_id=#{bd_group_bd}</if> )
</if>
<if test= "begin!=null" >
<if test= "begin!=null" >
AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o
AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o
<where >
<where >
<if test= "begin!=null" >
<if test= "begin!=null" >
o.date >=#{begin}
o.date >=#{begin}
</if>
</if>
<if test= "eng!=null" >
<if test= "eng!=null" >
o.date > #{end}
o.date > #{end}
</if>
</if>
</where> )
</where>
)
</if>
</if>
</where>
</where>
GROUP by c.clean_days
GROUP by c.clean_days
</select>
</select>
<select id= "listSecurePayMchs" resultType= "com.alibaba.fastjson.JSONObject" >
SELECT * FROM sys_clients sc where sc.org_id in (112,113) and is_valid=1
</select>
</mapper>
</mapper>