|
|
@@ -896,6 +896,196 @@
|
|
|
order by io.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryOrderListAll" resultType="com.jzg.commons.entity.orders.vo.OrderListVo">
|
|
|
+ SELECT
|
|
|
+ io.id as order_no,
|
|
|
+ io.company_id,
|
|
|
+ io.company_name,
|
|
|
+ io.product_id as productCode,
|
|
|
+ io.product_name as productName,
|
|
|
+ io.order_status,
|
|
|
+ io.create_time,
|
|
|
+ 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.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
|
|
|
+ LEFT JOIN
|
|
|
+ ins_orders_car_user_info owner_u on owner_u.order_no = io.id and owner_u.policy_person_type = 1
|
|
|
+ left JOIN
|
|
|
+ ins_orders_car_user_info policy_u on policy_u.order_no = io.id and policy_u.policy_person_type = 2
|
|
|
+ left JOIN
|
|
|
+ ins_orders_car_user_info insur_u on insur_u.order_no = io.id and insur_u.policy_person_type = 3
|
|
|
+ left join
|
|
|
+ ins_orders_risk iorci on iorci.order_no = io.id and iorci.risk_code = '0507'
|
|
|
+ left join
|
|
|
+ ins_orders_risk iorbi on iorbi.order_no = io.id and iorbi.risk_code = '0510'
|
|
|
+ LEFT JOIN
|
|
|
+ ins_orders_costs iorco on iorco.order_no = io.id
|
|
|
+ left join
|
|
|
+ sys_user su on su.mobile = io.real_quote_user_id
|
|
|
+ left join
|
|
|
+ sys_user_jzg_info suji on suji.user_id = su.id and suji.system_code = #{insOrdersParam.systemCode}
|
|
|
+ left join
|
|
|
+ sys_dept sd on sd.id = suji.dept_id
|
|
|
+ left join
|
|
|
+ ptl_agreement pa on pa.id = io.agreement_id
|
|
|
+ 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
|
|
|
+ 1=1
|
|
|
+
|
|
|
+ <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
|
|
|
+ AND io.id = #{insOrdersParam.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.parentId != null">
|
|
|
+ AND io.parent_id = #{insOrdersParam.parentId}
|
|
|
+ </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.recorder != null and insOrdersParam.recorder != ''">
|
|
|
+ AND su.username = #{insOrdersParam.recorder}
|
|
|
+ </if>
|
|
|
+ <if test="insOrdersParam.salesmanInfo != null and insOrdersParam.salesmanInfo != ''">
|
|
|
+ AND suji.name = #{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>
|
|
|
+
|
|
|
+ order by io.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getHistoryQuote" resultType="com.jzg.commons.entity.orders.vo.HistoryQuoteResultVo">
|
|
|
SELECT t.id as order_no,
|
|
|
t.license_no
|