|
@@ -1407,7 +1407,7 @@
|
|
|
) x WHERE x.rn = 1
|
|
) x WHERE x.rn = 1
|
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
|
<where>
|
|
<where>
|
|
|
- and io.is_delete = 0 and io.parent_id != '0' and sujis.type_attr NOT IN (1,2,3,4)
|
|
|
|
|
|
|
+ and io.is_delete = 0 and io.parent_id = '0' and sujis.type_attr NOT IN (1,2,3,4)
|
|
|
<if test="insOrdersParam.jzgInfoId != null and insOrdersParam.jzgInfoId != ''">
|
|
<if test="insOrdersParam.jzgInfoId != null and insOrdersParam.jzgInfoId != ''">
|
|
|
and io.real_quote_user_id in (select bbb.mobile from sys_user bbb where bbb.id in ( select ss.user_id
|
|
and io.real_quote_user_id in (select bbb.mobile from sys_user bbb where bbb.id in ( select ss.user_id
|
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
@@ -1620,7 +1620,7 @@
|
|
|
) x WHERE x.rn = 1
|
|
) x WHERE x.rn = 1
|
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
|
<where>
|
|
<where>
|
|
|
- and io.is_delete = 0 and io.parent_id != '0' and sujis.type_attr NOT IN (1,2,3,4)
|
|
|
|
|
|
|
+ and io.is_delete = 0 and io.parent_id = '0' and sujis.type_attr NOT IN (1,2,3,4)
|
|
|
<if test="insOrdersParam.jzgInfoId != null and insOrdersParam.jzgInfoId != ''">
|
|
<if test="insOrdersParam.jzgInfoId != null and insOrdersParam.jzgInfoId != ''">
|
|
|
and io.real_quote_user_id in (select bbb.mobile from sys_user bbb where bbb.id in ( select ss.user_id
|
|
and io.real_quote_user_id in (select bbb.mobile from sys_user bbb where bbb.id in ( select ss.user_id
|
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
@@ -1733,6 +1733,102 @@
|
|
|
WHERE dedup.rn = 1
|
|
WHERE dedup.rn = 1
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <!-- 根据主订单id集合查询其下的从订单(联表,不分页) -->
|
|
|
|
|
+ <select id="queryChildOrderListByParentIds" resultType="com.jzg.commons.entity.orders.vo.OrderListVo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ io.id as order_no,
|
|
|
|
|
+ io.parent_id as parentId,
|
|
|
|
|
+ io.quote_no as no,
|
|
|
|
|
+ io.company_id,
|
|
|
|
|
+ io.company_name,
|
|
|
|
|
+ io.product_id as productCode,
|
|
|
|
|
+ io.product_name as productName,
|
|
|
|
|
+ io.order_status,
|
|
|
|
|
+ io.create_time,
|
|
|
|
|
+ io.create_by,
|
|
|
|
|
+ io.error_message,
|
|
|
|
|
+ ioci.license_no,
|
|
|
|
|
+ ioci.vin_no,
|
|
|
|
|
+ owner_u.name as owner_name,
|
|
|
|
|
+ owner_u.mobile as owner_mobile,
|
|
|
|
|
+ policy_u.name as policy_name,
|
|
|
|
|
+ policy_u.mobile as policy_mobile,
|
|
|
|
|
+ insur_u.name as insur_name,
|
|
|
|
|
+ insur_u.mobile as insur_mobile,
|
|
|
|
|
+ iorci.start_date as ci_start_date,
|
|
|
|
|
+ iorbi.start_date as bi_start_date,
|
|
|
|
|
+ iorco.sum_premium as sumPremium,
|
|
|
|
|
+ iorco.jq_premium as ciPremium,
|
|
|
|
|
+ iorco.sy_premium as biPremium,
|
|
|
|
|
+ iorco.jy_premium as niPremium,
|
|
|
|
|
+ iorco.tax_premium as vvTax,
|
|
|
|
|
+ su.username as recorder,
|
|
|
|
|
+ suji.name as salesmanInfo,
|
|
|
|
|
+ suji.id as jzgInfoId,
|
|
|
|
|
+ sujis.type_attr as salesmanType,
|
|
|
|
|
+ pa.agreement_name as agreementName,
|
|
|
|
|
+ sd.name as deptName,
|
|
|
|
|
+ io.pay_link as paymentLink,
|
|
|
|
|
+ ioa.status as adjustStatus,
|
|
|
|
|
+ ioa.id as adjustId,
|
|
|
|
|
+ ioa1.after_premium as adjustPremium
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_orders io
|
|
|
|
|
+ LEFT JOIN ins_orders_car_info ioci ON ioci.order_no = io.id and ioci.is_delete = 0
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ ins_orders_car_user_info owner_u on owner_u.order_no = io.id and owner_u.policy_person_type = 1 and
|
|
|
|
|
+ owner_u.is_delete = 0
|
|
|
|
|
+ left JOIN
|
|
|
|
|
+ ins_orders_car_user_info policy_u on policy_u.order_no = io.id and policy_u.policy_person_type = 2 and
|
|
|
|
|
+ policy_u.is_delete = 0
|
|
|
|
|
+ left JOIN
|
|
|
|
|
+ ins_orders_car_user_info insur_u on insur_u.order_no = io.id and insur_u.policy_person_type = 3 and
|
|
|
|
|
+ insur_u.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ ins_orders_risk iorci on iorci.order_no = io.id and iorci.risk_code = '0507' and iorci.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ ins_orders_risk iorbi on iorbi.order_no = io.id and iorbi.risk_code = '0510' and iorbi.is_delete = 0
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ ins_orders_costs iorco on iorco.order_no = io.id and iorco.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ sys_user su on su.mobile = io.real_quote_user_id and su.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ sys_user_jzg_info suji on suji.user_id = su.id and suji.system_code = #{insOrdersParam.systemCode} and
|
|
|
|
|
+ suji.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ sys_user_jzg_info_salesman sujis ON suji.id = sujis.sys_user_jzg_info_id AND sujis.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ sys_dept sd on sd.id = suji.dept_id and sd.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ ptl_agreement pa on pa.id = io.agreement_id and pa.is_delete = 0
|
|
|
|
|
+ left join
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM (
|
|
|
|
|
+ SELECT t.*,
|
|
|
|
|
+ ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
|
|
|
|
|
+ FROM ins_order_adjust t where t.is_delete = 0
|
|
|
|
|
+ ) x WHERE x.rn = 1
|
|
|
|
|
+ ) ioa ON io.id = ioa.order_no
|
|
|
|
|
+ left join
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM (
|
|
|
|
|
+ SELECT t.*,
|
|
|
|
|
+ ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
|
|
|
|
|
+ FROM ins_order_adjust t where t.status = 2 and t.is_delete = 0
|
|
|
|
|
+ ) x WHERE x.rn = 1
|
|
|
|
|
+ ) ioa1 ON io.id = ioa1.order_no
|
|
|
|
|
+ <where>
|
|
|
|
|
+ and io.is_delete = 0 and io.parent_id in
|
|
|
|
|
+ <foreach collection="parentIds" item="pid" open="(" separator="," close=")">
|
|
|
|
|
+ #{pid}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ and sujis.type_attr NOT IN (1,2,3,4)
|
|
|
|
|
+ </where>
|
|
|
|
|
+ ORDER BY io.create_time DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
<select id="getHistoryQuote" resultType="com.jzg.commons.entity.orders.vo.HistoryQuoteResultVo">
|
|
<select id="getHistoryQuote" resultType="com.jzg.commons.entity.orders.vo.HistoryQuoteResultVo">
|
|
|
SELECT t.id as order_no,
|
|
SELECT t.id as order_no,
|
|
|
t.license_no
|
|
t.license_no
|