Commit 977a77ea by Water Wang

optimize

parent c8e9ee56
......@@ -140,7 +140,7 @@ where ps.practitioner_type_id = 28
concat(ifnull(sum(cf.order_price),0),'') as fyp,
concat(ifnull(sum(cf.fyc_amount),0),'') as fyc,
ifnull(count(cf.order_id),0) as pieces
from ag_acl_practitioner p inner join ag_acl_customer_fortune cf on p.customer_id = cf.customer_id and cf.drop_option_code = "S01"
from ag_acl_practitioner p inner join (select t.* from ag_acl_customer_fortune t group by t.order_id ) cf on p.customer_id = cf.customer_id and cf.drop_option_code = "S01"
inner join ag_po_order o on cf.order_id = o.id and o.status = 3
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
......
......@@ -285,7 +285,7 @@
s.practitioner_level practitionerLevelId
FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code = "S01")
INNER JOIN (select t.* from ag_acl_customer_fortune t group by t.order_id ) f ON f.customer_id = p.customer_id and f.drop_option_code = "S01")
INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE
o.status = 3 and o.order_price > 0
......
......@@ -610,7 +610,7 @@
ifnull(count(f.id),0) as count,-- 保单id
ifnull(sum(f.order_price),0) as fyp,-- 保费
ifnull(sum(f.fyc_amount),0) as fyc -- 应发佣金
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id and o.order_price > 0
FROM (select t.* from ag_acl_customer_fortune t group by t.order_id ) f INNER JOIN ag_po_order o ON f.order_id = o.id and o.order_price > 0
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
......@@ -700,7 +700,7 @@
left join ag_acl_insurer_branch b on p.insurer_branch_id = b.id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
left join ag_md_drop_options o on s.practitioner_level = o.id
where c.login = #{mobileNo};
where c.login = #{mobileNo}
</select>
<select id="findByCustomerIdIsActive" resultType="com.yd.dal.entity.customer.AclPractitioner">
......@@ -857,7 +857,7 @@
ifnull(count(f.id),0) as count,-- 保单id
ifnull(sum(f.order_price),0) as fyp,-- 保费
ifnull(sum(f.fyc_amount),0) as fyc -- 应发佣金
FROM ag_acl_customer_fortune f INNER JOIN ag_po_order o ON f.order_id = o.id and o.status = 3 and o.order_price > 0
FROM (select t.* from ag_acl_customer_fortune t group by t.order_id ) f INNER JOIN ag_po_order o ON f.order_id = o.id and o.status = 3 and o.order_price > 0
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment