FROM (select t.* from ag_acl_customer_fortune t where t.drop_option_code IN('S01','C01') group by t.order_id ) f
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_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
left join ag_acl_customer c on p.customer_id = c.id
left join ag_acl_customer c on p.customer_id = c.id
WHERE o.status = 3 and o.payment_status =3
WHERE o.status = 3 and o.payment_status =3 and f.drop_option_code IN('S01','C01')
<iftest="practitionerTypeId != null">
<iftest="practitionerTypeId != null">
and (s.practitioner_type_id = #{practitionerTypeId}
and (s.practitioner_type_id = #{practitionerTypeId}
or c.login in
or c.login in
...
@@ -1350,12 +1350,12 @@
...
@@ -1350,12 +1350,12 @@
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 (select t.* from ag_acl_customer_fortune t where t.drop_option_code IN('S01','C01') group by t.order_id ) f
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_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
WHERE o.status = 3 and o.payment_status =3
WHERE o.status = 3 and o.payment_status =3 and f.drop_option_code IN('S01','C01')
<iftest="practitionerTypeId != null">
<iftest="practitionerTypeId != null">
and s.practitioner_type_id = #{practitionerTypeId}
and s.practitioner_type_id = #{practitionerTypeId}
</if>
</if>
...
@@ -1394,7 +1394,8 @@
...
@@ -1394,7 +1394,8 @@
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
...
@@ -1414,14 +1415,14 @@
...
@@ -1414,14 +1415,14 @@
and YEAR(f.order_date) = YEAR(now())
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</otherwise>
</choose>
</choose>
<choose>
<!-- <choose> -->
<whentest="platform == 1">
<!-- <when test="platform == 1"> -->
and o.product_category_id = 8
<!-- and o.product_category_id = 8 -->
</when>
<!-- </when> -->
<otherwise>
<!-- <otherwise> -->
and o.product_category_id != 8 -- o.flag != 'Manual'
<!-- and o.product_category_id != 8 -->
</otherwise>
<!-- </otherwise> -->
</choose>
<!-- </choose> -->
group by p.id
group by p.id
</select>
</select>
...
@@ -1629,7 +1630,8 @@
...
@@ -1629,7 +1630,8 @@
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 (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 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
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