IF(o.payment_term IS NOT NULL ,CONCAT(o.payment_term,(CASE o.payment_term_unit WHEN 'Y' THEN '年' WHEN 'M' THEN '月' ELSE '日' END ) ),(SELECT e.element_text FROM ag_po_order_life_product_elements e WHERE o.id = e.order_id AND e.factor_code LIKE 'f_pay_term' LIMIT 1)) paymentTermUnit,
IF(o.cover_term IS NOT NULL ,o.cover_term_type ,(SELECT e.element_text FROM ag_po_order_life_product_elements e WHERE o.id = e.order_id AND e.factor_code LIKE 'f_coverage_term' LIMIT 1)) coverTermType,
o.order_price orderPrice,
...
...
@@ -86,8 +91,6 @@
LEFT JOIN ag_po_order o ON o.id = t.order_id
LEFT JOIN ag_product p ON p.id = o.product_id
LEFT JOIN ag_product_plan pp ON pp.id = o.plan_id
LEFT JOIN ag_po_order_commission oc ON oc.order_id = t.order_id AND oc.id = t.commission_id
LEFT JOIN ag_po_order_commission_check c on oc.commission_check_id = c.id
LEFT JOIN ag_acl_insurer i ON i.id = o.insurer_id
LEFT JOIN ag_acl_practitioner pra ON pra.customer_id = t.customer_id
LEFT JOIN ag_acl_insurer_branch_dept dept ON pra.dept_id = dept.id
...
...
@@ -101,23 +104,25 @@
WHERE t.settlement_type = '1'
AND mas.drop_code = 'Fortune_Payout_Status'
AND mas1.scenario_code = 'practitioner_level'
AND oc.commission_status = '2'
and setting.practitioner_type_id = 28
<iftest="item.policyNo != null">
and o.policy_no like concat(concat('%',#{item.policyNo,jdbcType=VARCHAR}),'%')
</if>
<iftest="item.insurerId != null">
AND i.id = #{item.insurerId,jdbcType=BIGINT}
</if>
<iftest="item.insurerBranchId != null">
and pra.insurer_branch_id = #{item.insurerBranchId,jdbcType=BIGINT}
</if>
<iftest="item.insurerBranchDeptId != null">
and dept.id = #{item.insurerBranchDeptId,jdbcType=BIGINT}
</if>
<!-- <if test="item.subordinateSystemId != null">
and sub.id = #{item.subordinateSystemId,jdbcType=BIGINT}
</if>-->
and EXISTS(select 1 from ag_po_order_commission poc
where poc.commission_status='2' and poc.commission_type='1'
and poc.order_id=t.order_id and poc.commission_period=t.commission_period)
<iftest="item.policyNo != null">
and o.policy_no like concat(concat('%',#{item.policyNo,jdbcType=VARCHAR}),'%')
</if>
<iftest="item.insurerId != null">
AND i.id = #{item.insurerId,jdbcType=BIGINT}
</if>
<iftest="item.insurerBranchId != null">
and pra.insurer_branch_id = #{item.insurerBranchId,jdbcType=BIGINT}
</if>
<iftest="item.insurerBranchDeptId != null">
and dept.id = #{item.insurerBranchDeptId,jdbcType=BIGINT}
</if>
<!-- <if test="item.subordinateSystemId != null">
and sub.id = #{item.subordinateSystemId,jdbcType=BIGINT}
</if>-->
<iftest="item.subsystemIdList != null and item.subsystemIdList.size() > 0">