|
|
@@ -882,7 +882,7 @@
|
|
|
su.username as recorder,
|
|
|
suji.name as salesmanInfo,
|
|
|
suji.id as jzgInfoId,
|
|
|
- suji.type_attr as salesmanType,
|
|
|
+ sujis.type_attr as salesmanType,
|
|
|
pa.agreement_name as agreementName,
|
|
|
sd.name as deptName,
|
|
|
io.pay_link as paymentLink,
|
|
|
@@ -909,6 +909,8 @@
|
|
|
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
|
|
|
@@ -931,7 +933,7 @@
|
|
|
) x WHERE x.rn = 1
|
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
|
<where>
|
|
|
- and io.is_delete = 0 and io.parent_id != '0'
|
|
|
+ and io.is_delete = 0 and io.parent_id != '0' and sujis.type_attr !=3
|
|
|
<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
|
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
|
@@ -1014,7 +1016,7 @@
|
|
|
AND su.username = #{insOrdersParam.salesmanInfo}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.salesmanType != null and insOrdersParam.salesmanType != ''">
|
|
|
- AND suji.type_attr = #{insOrdersParam.salesmanType}
|
|
|
+ AND sujis.type_attr = #{insOrdersParam.salesmanType}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.agreementName != null and insOrdersParam.agreementName != ''">
|
|
|
AND pa.agreement_name = #{insOrdersParam.agreementName}
|
|
|
@@ -1070,7 +1072,7 @@
|
|
|
iorco.tax_premium as vvTax,
|
|
|
su.username as recorder,
|
|
|
suji.name as salesmanInfo,
|
|
|
- suji.type_attr as salesmanType,
|
|
|
+ sujis.type_attr as salesmanType,
|
|
|
pa.agreement_name as agreementName,
|
|
|
sd.name as deptName,
|
|
|
io.pay_link as paymentLink,
|
|
|
@@ -1097,6 +1099,8 @@
|
|
|
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
|
|
|
@@ -1119,7 +1123,7 @@
|
|
|
) x WHERE x.rn = 1
|
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
|
<where>
|
|
|
- and io.is_delete = 0
|
|
|
+ and io.is_delete = 0 and sujis.type_attr !=3
|
|
|
<if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
|
|
|
AND io.id = #{insOrdersParam.orderNo}
|
|
|
</if>
|
|
|
@@ -1203,7 +1207,7 @@
|
|
|
AND suji.name = #{insOrdersParam.salesmanInfo}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.salesmanType != null and insOrdersParam.salesmanType != ''">
|
|
|
- AND suji.type_attr = #{insOrdersParam.salesmanType}
|
|
|
+ AND sujis.type_attr = #{insOrdersParam.salesmanType}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.agreementName != null and insOrdersParam.agreementName != ''">
|
|
|
AND pa.agreement_name = #{insOrdersParam.agreementName}
|
|
|
@@ -1264,7 +1268,7 @@
|
|
|
su.username as recorder,
|
|
|
suji.name as salesmanInfo,
|
|
|
suji.id as jzgInfoId,
|
|
|
- suji.type_attr as salesmanType,
|
|
|
+ sujis.type_attr as salesmanType,
|
|
|
pa.agreement_name as agreementName,
|
|
|
sd.name as deptName,
|
|
|
io.pay_link as paymentLink,
|
|
|
@@ -1272,176 +1276,186 @@
|
|
|
ioa.id as adjustId,
|
|
|
ioa1.after_premium as adjustPremium
|
|
|
FROM (
|
|
|
- SELECT dedup.order_id
|
|
|
- FROM (
|
|
|
- SELECT
|
|
|
- io.id AS order_id,
|
|
|
- io.create_time,
|
|
|
- ROW_NUMBER() OVER(PARTITION BY COALESCE(ioci.license_no, io.id), io.order_status ORDER BY io.create_time DESC) AS rn
|
|
|
- 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_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 != '0'
|
|
|
- <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
|
|
|
- from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
|
- =#{insOrdersParam.jzgInfoId}) and ss.is_delete = 0 ) and bbb.is_delete = 0 )
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
|
|
|
- AND io.id = #{insOrdersParam.orderNo}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
|
|
|
- AND ioci.license_no = #{insOrdersParam.licenseNo}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.orderStatus!= null and insOrdersParam.orderStatus!= ''">
|
|
|
- AND io.order_status = #{insOrdersParam.orderStatus}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.adjustStatus!= null and insOrdersParam.adjustStatus!= ''">
|
|
|
- AND ioa.status = #{insOrdersParam.adjustStatus}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.salesman!= null">
|
|
|
- AND io.real_quote_user_id = #{insOrdersParam.salesman}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.companyId != null and insOrdersParam.companyId != ''">
|
|
|
- AND io.company_id = #{insOrdersParam.companyId}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.startDate != null and insOrdersParam.startDate != ''and insOrdersParam.endDate != null and insOrdersParam.endDate != ''">
|
|
|
- AND io.create_time BETWEEN #{insOrdersParam.startDate} and #{insOrdersParam.endDate}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.companyName != null and insOrdersParam.companyName != ''">
|
|
|
- AND io.company_name = #{insOrdersParam.companyName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.productCode != null and insOrdersParam.productCode != ''">
|
|
|
- AND io.product_id = #{insOrdersParam.productCode}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.productName != null and insOrdersParam.productName != ''">
|
|
|
- AND io.product_name = #{insOrdersParam.productName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.vinNo != null and insOrdersParam.vinNo != ''">
|
|
|
- AND ioci.vin_no = #{insOrdersParam.vinNo}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.ownerName != null and insOrdersParam.ownerName != ''">
|
|
|
- AND owner_u.name = #{insOrdersParam.ownerName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.ownerMobile != null and insOrdersParam.ownerMobile != ''">
|
|
|
- AND owner_u.mobile = #{insOrdersParam.ownerMobile}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.policyName != null and insOrdersParam.policyName != ''">
|
|
|
- AND policy_u.name = #{insOrdersParam.policyName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.policyMobile != null and insOrdersParam.policyMobile != ''">
|
|
|
- AND policy_u.mobile = #{insOrdersParam.policyMobile}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.insurName != null and insOrdersParam.insurName != ''">
|
|
|
- AND insur_u.name = #{insOrdersParam.insurName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.insurMobile != null and insOrdersParam.insurMobile != ''">
|
|
|
- AND insur_u.mobile = #{insOrdersParam.insurMobile}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.ciStartDate != null">
|
|
|
- AND iorci.start_date = #{insOrdersParam.ciStartDate}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.biStartDate != null">
|
|
|
- AND iorbi.start_date = #{insOrdersParam.biStartDate}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.sumPremium != null">
|
|
|
- AND iorco.sum_premium = #{insOrdersParam.sumPremium}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.ciPremium != null">
|
|
|
- AND iorco.jq_premium = #{insOrdersParam.ciPremium}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.biPremium != null">
|
|
|
- AND iorco.sy_premium = #{insOrdersParam.biPremium}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.niPremium != null">
|
|
|
- AND iorco.jy_premium = #{insOrdersParam.niPremium}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.vvTax != null">
|
|
|
- AND iorco.tax_premium = #{insOrdersParam.vvTax}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.salesmanInfo != null and insOrdersParam.salesmanInfo != ''">
|
|
|
- AND su.username = #{insOrdersParam.salesmanInfo}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.salesmanType != null and insOrdersParam.salesmanType != ''">
|
|
|
- AND suji.type_attr = #{insOrdersParam.salesmanType}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.agreementName != null and insOrdersParam.agreementName != ''">
|
|
|
- AND pa.agreement_name = #{insOrdersParam.agreementName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.deptId != null and insOrdersParam.deptId != ''">
|
|
|
- AND sd.id = #{insOrdersParam.deptId}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.deptName != null and insOrdersParam.deptName != ''">
|
|
|
- AND sd.name = #{insOrdersParam.deptName}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.paymentLink != null and insOrdersParam.paymentLink != ''">
|
|
|
- AND io.pay_link = #{insOrdersParam.paymentLink}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.adjustId != null">
|
|
|
- AND ioa.id = #{insOrdersParam.adjustId}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.adjustPremium != null">
|
|
|
- AND ioa1.after_premium = #{insOrdersParam.adjustPremium}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.startSigningTime != null and insOrdersParam.startSigningTime != ''and insOrdersParam.endSigningTime != null and insOrdersParam.endSigningTime != ''">
|
|
|
- AND io.signing_time BETWEEN #{insOrdersParam.startSigningTime} and #{insOrdersParam.endSigningTime}
|
|
|
- </if>
|
|
|
- <if test="insOrdersParam.startPayTime != null and insOrdersParam.startPayTime != ''and insOrdersParam.endPayTime != null and insOrdersParam.endPayTime != ''">
|
|
|
- AND io.pay_time BETWEEN #{insOrdersParam.startPayTime} and #{insOrdersParam.endPayTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) dedup
|
|
|
- WHERE dedup.rn = 1
|
|
|
- ORDER BY dedup.create_time DESC
|
|
|
- LIMIT #{offset}, #{size}
|
|
|
+ SELECT dedup.order_id
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ io.id AS order_id,
|
|
|
+ io.create_time,
|
|
|
+ ROW_NUMBER() OVER(PARTITION BY COALESCE(ioci.license_no, io.id), io.order_status ORDER BY io.create_time DESC)
|
|
|
+ AS rn
|
|
|
+ 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 != '0' and sujis.type_attr !=3
|
|
|
+ <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
|
|
|
+ from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
|
+ =#{insOrdersParam.jzgInfoId}) and ss.is_delete = 0 ) and bbb.is_delete = 0 )
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
|
|
|
+ AND io.id = #{insOrdersParam.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
|
|
|
+ AND ioci.license_no = #{insOrdersParam.licenseNo}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.orderStatus!= null and insOrdersParam.orderStatus!= ''">
|
|
|
+ AND io.order_status = #{insOrdersParam.orderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.adjustStatus!= null and insOrdersParam.adjustStatus!= ''">
|
|
|
+ AND ioa.status = #{insOrdersParam.adjustStatus}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.salesman!= null">
|
|
|
+ AND io.real_quote_user_id = #{insOrdersParam.salesman}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.companyId != null and insOrdersParam.companyId != ''">
|
|
|
+ AND io.company_id = #{insOrdersParam.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.startDate != null and insOrdersParam.startDate != ''and insOrdersParam.endDate != null and insOrdersParam.endDate != ''">
|
|
|
+ AND io.create_time BETWEEN #{insOrdersParam.startDate} and #{insOrdersParam.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.companyName != null and insOrdersParam.companyName != ''">
|
|
|
+ AND io.company_name = #{insOrdersParam.companyName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.productCode != null and insOrdersParam.productCode != ''">
|
|
|
+ AND io.product_id = #{insOrdersParam.productCode}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.productName != null and insOrdersParam.productName != ''">
|
|
|
+ AND io.product_name = #{insOrdersParam.productName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.vinNo != null and insOrdersParam.vinNo != ''">
|
|
|
+ AND ioci.vin_no = #{insOrdersParam.vinNo}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.ownerName != null and insOrdersParam.ownerName != ''">
|
|
|
+ AND owner_u.name = #{insOrdersParam.ownerName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.ownerMobile != null and insOrdersParam.ownerMobile != ''">
|
|
|
+ AND owner_u.mobile = #{insOrdersParam.ownerMobile}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.policyName != null and insOrdersParam.policyName != ''">
|
|
|
+ AND policy_u.name = #{insOrdersParam.policyName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.policyMobile != null and insOrdersParam.policyMobile != ''">
|
|
|
+ AND policy_u.mobile = #{insOrdersParam.policyMobile}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.insurName != null and insOrdersParam.insurName != ''">
|
|
|
+ AND insur_u.name = #{insOrdersParam.insurName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.insurMobile != null and insOrdersParam.insurMobile != ''">
|
|
|
+ AND insur_u.mobile = #{insOrdersParam.insurMobile}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.ciStartDate != null">
|
|
|
+ AND iorci.start_date = #{insOrdersParam.ciStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.biStartDate != null">
|
|
|
+ AND iorbi.start_date = #{insOrdersParam.biStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.sumPremium != null">
|
|
|
+ AND iorco.sum_premium = #{insOrdersParam.sumPremium}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.ciPremium != null">
|
|
|
+ AND iorco.jq_premium = #{insOrdersParam.ciPremium}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.biPremium != null">
|
|
|
+ AND iorco.sy_premium = #{insOrdersParam.biPremium}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.niPremium != null">
|
|
|
+ AND iorco.jy_premium = #{insOrdersParam.niPremium}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.vvTax != null">
|
|
|
+ AND iorco.tax_premium = #{insOrdersParam.vvTax}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.salesmanInfo != null and insOrdersParam.salesmanInfo != ''">
|
|
|
+ AND su.username = #{insOrdersParam.salesmanInfo}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.salesmanType != null and insOrdersParam.salesmanType != ''">
|
|
|
+ AND sujis.type_attr = #{insOrdersParam.salesmanType}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.agreementName != null and insOrdersParam.agreementName != ''">
|
|
|
+ AND pa.agreement_name = #{insOrdersParam.agreementName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.deptId != null and insOrdersParam.deptId != ''">
|
|
|
+ AND sd.id = #{insOrdersParam.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.deptName != null and insOrdersParam.deptName != ''">
|
|
|
+ AND sd.name = #{insOrdersParam.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.paymentLink != null and insOrdersParam.paymentLink != ''">
|
|
|
+ AND io.pay_link = #{insOrdersParam.paymentLink}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.adjustId != null">
|
|
|
+ AND ioa.id = #{insOrdersParam.adjustId}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.adjustPremium != null">
|
|
|
+ AND ioa1.after_premium = #{insOrdersParam.adjustPremium}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.startSigningTime != null and insOrdersParam.startSigningTime != ''and insOrdersParam.endSigningTime != null and insOrdersParam.endSigningTime != ''">
|
|
|
+ AND io.signing_time BETWEEN #{insOrdersParam.startSigningTime} and #{insOrdersParam.endSigningTime}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.startPayTime != null and insOrdersParam.startPayTime != ''and insOrdersParam.endPayTime != null and insOrdersParam.endPayTime != ''">
|
|
|
+ AND io.pay_time BETWEEN #{insOrdersParam.startPayTime} and #{insOrdersParam.endPayTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) dedup
|
|
|
+ WHERE dedup.rn = 1
|
|
|
+ ORDER BY dedup.create_time DESC
|
|
|
+ LIMIT #{offset}, #{size}
|
|
|
) p
|
|
|
JOIN ins_orders io ON io.id = p.order_id
|
|
|
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
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ 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
|
|
|
@@ -1451,7 +1465,10 @@
|
|
|
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
|
|
|
+ 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
|
|
|
@@ -1502,6 +1519,8 @@
|
|
|
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
|
|
|
@@ -1525,7 +1544,7 @@
|
|
|
) x WHERE x.rn = 1
|
|
|
) ioa1 ON io.id = ioa1.order_no
|
|
|
<where>
|
|
|
- and io.is_delete = 0 and io.parent_id != '0'
|
|
|
+ and io.is_delete = 0 and io.parent_id != '0' and sujis.type_attr !=3
|
|
|
<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
|
|
|
from sys_user_jzg_info ss where 1 =1 and (ss.leader_id = #{insOrdersParam.jzgInfoId} or ss.id
|
|
|
@@ -1607,7 +1626,7 @@
|
|
|
AND su.username = #{insOrdersParam.salesmanInfo}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.salesmanType != null and insOrdersParam.salesmanType != ''">
|
|
|
- AND suji.type_attr = #{insOrdersParam.salesmanType}
|
|
|
+ AND sujis.type_attr = #{insOrdersParam.salesmanType}
|
|
|
</if>
|
|
|
<if test="insOrdersParam.agreementName != null and insOrdersParam.agreementName != ''">
|
|
|
AND pa.agreement_name = #{insOrdersParam.agreementName}
|