FROM (select t.* from ag_acl_customer_fortune t where t.drop_option_code = "S01" group by t.order_id ) 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 where t.drop_option_code = "S01" 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
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_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
...
@@ -644,7 +1292,7 @@
...
@@ -644,7 +1292,7 @@
and YEAR(f.order_date) = YEAR(now())
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</otherwise>
</choose>
</choose>
group by p.id;
group by p.id
</select>
</select>
...
@@ -657,13 +1305,13 @@
...
@@ -657,13 +1305,13 @@
ifnull(count(f.id),0) as count,-- 保单id
ifnull(count(f.id),0) as count,-- 保单id
ifnull(sum(f.order_price),0) as fyp,-- 保费
ifnull(sum(f.order_price),0) as fyp,-- 保费
ifnull(sum(f.fyc_amount),0) as fyc -- 应发佣金
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 ag_acl_customer_fortune 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
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_customer c on p.customer_id = c.id
left join ag_acl_customer c on p.customer_id = c.id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
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
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
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_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
...
@@ -904,7 +1553,7 @@
...
@@ -904,7 +1553,7 @@
t.CREATE_USER as createUser
t.CREATE_USER as createUser
from mon011 t INNER JOIN mon025 m ON m.MON025_007 = t.FK_SAL_MST_ID
from mon011 t INNER JOIN mon025 m ON m.MON025_007 = t.FK_SAL_MST_ID
INNER JOIN mon006 cl on t.MON_DTL_PERIOD = cl.MON_CLS_PERIOD and cl.MON_CLS_TYPE = 1
INNER JOIN mon006 cl on t.MON_DTL_PERIOD = cl.MON_CLS_PERIOD and cl.MON_CLS_TYPE = 1
WHERE m.MON025_109 = 7 AND t.FK_SAL_MST_ID = #{practitionerIdEG,jdbcType=VARCHAR};
WHERE m.MON025_109 = 7 AND t.FK_SAL_MST_ID = #{practitionerIdEG,jdbcType=VARCHAR}