|
@@ -376,24 +376,60 @@
|
|
|
count(1)
|
|
count(1)
|
|
|
from (
|
|
from (
|
|
|
select
|
|
select
|
|
|
- io.orderno
|
|
|
|
|
|
|
+ (0)
|
|
|
from
|
|
from
|
|
|
- ins_orders io
|
|
|
|
|
- <!--如果存在 公司查询则进行连表 -->
|
|
|
|
|
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
|
|
- left JOIN
|
|
|
|
|
- ins_area_company iac on iac.orderno = io.orderno
|
|
|
|
|
- </if>
|
|
|
|
|
- where
|
|
|
|
|
- io.del_flag = 1
|
|
|
|
|
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
|
|
- and io.orderno = #{orderQueryVo.orderNo}
|
|
|
|
|
|
|
+ ins_area_company iac
|
|
|
|
|
+ left JOIN
|
|
|
|
|
+ ins_orders io on iac.orderno = io.orderno
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ sys_dept dept ON dept.id = io.deptid
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ sys_user u on io.userid = u.id
|
|
|
|
|
+ left join
|
|
|
|
|
+ ptl_agreement agree on iac.agreement_id= agree.id
|
|
|
|
|
+ left join
|
|
|
|
|
+ esm_ins_company company on agree.partner_companies_id= company.id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="agentUserIds != null and agentUserIds.size>0" >
|
|
|
|
|
+ AND (
|
|
|
|
|
+ (io.userid in
|
|
|
|
|
+ <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
|
|
|
|
|
+ <if test="deptIds != null and deptIds.size>0" >
|
|
|
|
|
+ AND (
|
|
|
|
|
+ <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
|
|
|
|
|
+ io.deptid like CONCAT('', #{item}, '%')
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="flag" >
|
|
|
|
|
+ OR iac.operator_id = #{orderQueryVo.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
|
|
|
|
|
- and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
|
|
|
|
+ <if test="agreeIds != null and agreeIds.size>0">
|
|
|
|
|
+ AND (
|
|
|
|
|
+ (iac.company_id in
|
|
|
|
|
+ <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
|
|
|
|
|
+ <if test="flag" >
|
|
|
|
|
+ OR iac.operator_id = #{orderQueryVo.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
|
|
- and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
|
|
+ and iac.id = #{orderQueryVo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource.size > 0">
|
|
|
|
|
+ and dept.management_source in
|
|
|
|
|
+ <foreach item="source" collection="orderQueryVo.managementSource" open="(" separator="," close=")">
|
|
|
|
|
+ #{source}
|
|
|
|
|
+ </foreach>
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
<if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
and io.frameno = #{orderQueryVo.frameNo}
|
|
and io.frameno = #{orderQueryVo.frameNo}
|
|
@@ -402,38 +438,99 @@
|
|
|
and io.licenseno = #{orderQueryVo.licenseNo}
|
|
and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
<if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
- and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
|
|
|
|
+ and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
|
|
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
|
|
|
|
|
+ and iac.createtime >= #{orderQueryVo.quoteStartDateStr} AND iac.createtime <![CDATA[ <= ]]> #{orderQueryVo.quoteEndDateStr}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
<if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
and iac.company_id = #{orderQueryVo.companyId}
|
|
and iac.company_id = #{orderQueryVo.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
- <!--
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
|
|
|
|
|
- and io.operatorid = #{orderQueryVo.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- -->
|
|
|
|
|
|
|
+ <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
|
|
|
|
|
+ and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.provinceId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.cityId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.countyId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.houseId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
|
|
|
|
|
+ and iac.agreement_id = #{orderQueryVo.agreeId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
|
|
|
|
|
+ and io.orderno = #{orderQueryVo.taskNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
|
|
|
|
|
+ and iac.product = #{orderQueryVo.riskCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
|
|
|
|
|
+ and u.leader_id = #{orderQueryVo.leaderId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
|
|
|
|
|
+ and u.leader_name = #{orderQueryVo.leaderName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
|
|
|
|
|
+ and ((
|
|
|
|
|
+ DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
|
|
|
|
|
+ AND #{orderQueryVo.attachEndDateStr}
|
|
|
|
|
+ )
|
|
|
|
|
+ OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
<choose>
|
|
<choose>
|
|
|
- <when test="isCdy">
|
|
|
|
|
- <if test="deptId != null and deptId != '' ">
|
|
|
|
|
- and io.deptid like "${deptId}%"
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <when test="type==1">
|
|
|
|
|
+ and dept.management_source=1
|
|
|
</when>
|
|
</when>
|
|
|
- <when test="isDxFlag">
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
|
|
|
|
|
- and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
|
|
|
|
|
- #{orderQueryVo.userId} )
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <when test="type==2">
|
|
|
|
|
+ and dept.management_source=2
|
|
|
</when>
|
|
</when>
|
|
|
- <otherwise>
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
|
|
|
|
|
- and io.userid = #{orderQueryVo.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- </otherwise>
|
|
|
|
|
</choose>
|
|
</choose>
|
|
|
- group by io.orderno
|
|
|
|
|
|
|
+ <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
|
|
|
|
|
+ and iac.signing_time >= #{orderQueryVo.signStartDateStr} AND iac.signing_time <![CDATA[ <= ]]> #{orderQueryVo.signEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
|
|
|
|
|
+ and io.entry_status = #{orderQueryVo.entryStatus }
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
|
|
|
|
|
+ and iac.update_status = #{orderQueryVo.updateStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.partnerCompaniesId != null and orderQueryVo.partnerCompaniesId != null">
|
|
|
|
|
+ and agree.partner_companies_id = #{orderQueryVo.partnerCompaniesId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and (io.del_flag = 0)
|
|
|
|
|
+ </where>
|
|
|
|
|
+ group by io.orderno,
|
|
|
|
|
+ iac.orderstatus,
|
|
|
|
|
+ iac.productid,
|
|
|
|
|
+ iac.product,
|
|
|
|
|
+ iac.jq_start_date,
|
|
|
|
|
+ iac.jq_end_date,
|
|
|
|
|
+ iac.sy_start_date,
|
|
|
|
|
+ iac.sy_end_date,
|
|
|
|
|
+ iac.jqpremium,
|
|
|
|
|
+ iac.sypremium,
|
|
|
|
|
+ iac.jypremium,
|
|
|
|
|
+ iac.taxamount,
|
|
|
|
|
+ iac.id
|
|
|
) as s
|
|
) as s
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -510,28 +607,130 @@
|
|
|
order by io.createtime desc
|
|
order by io.createtime desc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<select id="queryPageDeleteOrder" resultMap="BaseResultMap">
|
|
<select id="queryPageDeleteOrder" resultMap="BaseResultMap">
|
|
|
select
|
|
select
|
|
|
- io.*
|
|
|
|
|
|
|
+ io.orderno as orderno,
|
|
|
|
|
+ io.quoteno as quoteno,
|
|
|
|
|
+ iac.orderstatus as orderstatus,
|
|
|
|
|
+ io.carinfo as carinfo,
|
|
|
|
|
+ io.userid as userid,
|
|
|
|
|
+ io.username as username,
|
|
|
|
|
+ io.deptid as deptid,
|
|
|
|
|
+ io.deptname as deptname,
|
|
|
|
|
+ io.ownerinfo as ownerinfo,
|
|
|
|
|
+ io.applyinfo as applyinfo,
|
|
|
|
|
+ io.insureinfo as insureinfo,
|
|
|
|
|
+ io.agreeid as agreeid,
|
|
|
|
|
+ iac.productid as productid,
|
|
|
|
|
+ iac.product as product,
|
|
|
|
|
+ MAX(iac.createtime) as createtime,
|
|
|
|
|
+ io.frameno as frameno,
|
|
|
|
|
+ io.licenseno as licenseno,
|
|
|
|
|
+ REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') as insuredname,
|
|
|
|
|
+ iac.jq_start_date as jqstartdate,
|
|
|
|
|
+ iac.jq_end_date as jqenddate,
|
|
|
|
|
+ iac.sy_start_date as systartdate,
|
|
|
|
|
+ iac.sy_end_date as syenddate,
|
|
|
|
|
+ iac.jqpremium as jqpremium,
|
|
|
|
|
+ iac.sypremium as sypremium,
|
|
|
|
|
+ iac.jypremium as jypremium,
|
|
|
|
|
+ iac.taxamount as taxamount,
|
|
|
|
|
+ io.risk as risk,
|
|
|
|
|
+ io.king as king,
|
|
|
|
|
+ io.vehicle_and_vessel_tax as vehicleAndVesselTax,
|
|
|
|
|
+ iac.id as subOrderId,
|
|
|
|
|
+ iac.underwriting_status as underwritingStatus,
|
|
|
|
|
+ iac.company_id as company_id,
|
|
|
|
|
+ iac.inscompany as ins_company,
|
|
|
|
|
+ agree.agreement_code as agreementCode,
|
|
|
|
|
+ agree.agreement_name as agreementName,
|
|
|
|
|
+ company.namesimple as partnerCompaniesName,
|
|
|
|
|
+ dept.province,
|
|
|
|
|
+ dept.city,
|
|
|
|
|
+ dept.area,
|
|
|
|
|
+ d1.area_cname as province_name,
|
|
|
|
|
+ d2.area_cname as city_name,
|
|
|
|
|
+ d3.area_cname as area_name,
|
|
|
|
|
+ concat(d1.area_cname,d2.area_cname,d3.area_cname) as area_info,
|
|
|
|
|
+ iac.api_type,
|
|
|
|
|
+ io.is_external,
|
|
|
|
|
+ u.leader_name,
|
|
|
|
|
+ u.leader_id,
|
|
|
|
|
+ CASE dept.management_source
|
|
|
|
|
+ WHEN '1' THEN '渠道'
|
|
|
|
|
+ WHEN '2' THEN '个代'
|
|
|
|
|
+ WHEN '3' THEN '电销'
|
|
|
|
|
+ ELSE '' END
|
|
|
|
|
+ AS managementSource,
|
|
|
|
|
+ io.entry_status as entryStatus,
|
|
|
|
|
+ iac.underwriting_time as underwritingTime,
|
|
|
|
|
+ iac.pay_date as payDate,
|
|
|
|
|
+ iac.update_status AS updateStatus,
|
|
|
|
|
+ iac.update_status_time AS updateStatusTime,
|
|
|
|
|
+ iac.signing_time as signingTime,
|
|
|
|
|
+ oou.NAME as operatorName
|
|
|
from
|
|
from
|
|
|
- ins_orders io
|
|
|
|
|
- <!--如果存在 公司查询则进行连表 -->
|
|
|
|
|
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
|
|
- left JOIN
|
|
|
|
|
- ins_area_company iac on iac.orderno = io.orderno
|
|
|
|
|
- </if>
|
|
|
|
|
- where
|
|
|
|
|
- io.del_flag = 1
|
|
|
|
|
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
|
|
- and io.orderno = #{orderQueryVo.orderNo}
|
|
|
|
|
|
|
+ ins_area_company iac
|
|
|
|
|
+ left JOIN
|
|
|
|
|
+ ins_orders io on iac.orderno = io.orderno
|
|
|
|
|
+ left join
|
|
|
|
|
+ ptl_agreement agree on iac.agreement_id= agree.id
|
|
|
|
|
+ left join
|
|
|
|
|
+ esm_ins_company company on agree.partner_companies_id= company.id
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ sys_dept dept ON dept.id = io.deptid
|
|
|
|
|
+ LEFT JOIN sys_dept pdept on dept.parent_id = pdept.id
|
|
|
|
|
+ LEFT JOIN sys_area d1 ON d1.area_code = pdept.province
|
|
|
|
|
+ LEFT JOIN sys_area d2 ON d2.area_code = pdept.city
|
|
|
|
|
+ LEFT JOIN sys_area d3 ON d3.area_code = pdept.area
|
|
|
|
|
+ LEFT JOIN
|
|
|
|
|
+ sys_user u on io.userid = u.id
|
|
|
|
|
+ LEFT JOIN sys_user oou ON io.operatorid = oou.id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="agentUserIds != null and agentUserIds.size>0" >
|
|
|
|
|
+ AND (
|
|
|
|
|
+ (io.userid in
|
|
|
|
|
+ <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
|
|
|
|
|
+ <if test="deptIds != null and deptIds.size>0" >
|
|
|
|
|
+ AND (
|
|
|
|
|
+ <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
|
|
|
|
|
+ io.deptid like CONCAT('', #{item}, '%')
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="flag" >
|
|
|
|
|
+ OR iac.operator_id = #{orderQueryVo.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
|
|
|
|
|
- and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
|
|
|
|
+ <if test="agreeIds != null and agreeIds.size>0">
|
|
|
|
|
+ AND (
|
|
|
|
|
+ (iac.company_id in
|
|
|
|
|
+ <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
|
|
|
|
|
+ <if test="flag" >
|
|
|
|
|
+ OR iac.operator_id = #{orderQueryVo.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ )
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
|
|
- and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
|
|
+ and iac.id = #{orderQueryVo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource.size > 0">
|
|
|
|
|
+ and dept.management_source in
|
|
|
|
|
+ <foreach item="source" collection="orderQueryVo.managementSource" open="(" separator="," close=")">
|
|
|
|
|
+ #{source}
|
|
|
|
|
+ </foreach>
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
<if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
and io.frameno = #{orderQueryVo.frameNo}
|
|
and io.frameno = #{orderQueryVo.frameNo}
|
|
|
</if>
|
|
</if>
|
|
@@ -539,47 +738,105 @@
|
|
|
and io.licenseno = #{orderQueryVo.licenseNo}
|
|
and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
<if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
- and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
|
|
|
|
+ and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
|
|
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
|
|
|
|
|
+ and iac.createtime >= #{orderQueryVo.quoteStartDateStr} AND iac.createtime <![CDATA[ <= ]]> #{orderQueryVo.quoteEndDateStr}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
<if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
and iac.company_id = #{orderQueryVo.companyId}
|
|
and iac.company_id = #{orderQueryVo.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
|
|
|
|
|
- and io.product = #{orderQueryVo.product}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
|
|
|
|
|
+ and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
|
|
|
|
|
- and io.productid = #{orderQueryVo.productid}
|
|
|
|
|
|
|
+ <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.provinceId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.cityId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.countyId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
|
|
|
|
|
+ and io.deptid like "${orderQueryVo.houseId}%"
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
|
|
|
|
|
+ and iac.agreement_id = #{orderQueryVo.agreeId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
|
|
|
|
|
+ and io.orderno = #{orderQueryVo.taskNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
|
|
|
|
|
+ and iac.product = #{orderQueryVo.riskCode}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
- <!--
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
|
|
|
|
|
- and io.operatorid = #{orderQueryVo.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- -->
|
|
|
|
|
|
|
+ <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
|
|
|
|
|
+ and u.leader_id = #{orderQueryVo.leaderId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
|
|
|
|
|
+ and u.leader_name = #{orderQueryVo.leaderName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
|
|
|
|
|
+ and ((
|
|
|
|
|
+ DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
|
|
|
|
|
+ AND #{orderQueryVo.attachEndDateStr}
|
|
|
|
|
+ )
|
|
|
|
|
+ OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
<choose>
|
|
<choose>
|
|
|
- <when test="isCdy">
|
|
|
|
|
- <if test="deptId != null and deptId != '' ">
|
|
|
|
|
- and io.deptid like "${deptId}%"
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <when test="type==1">
|
|
|
|
|
+ and dept.management_source=1
|
|
|
</when>
|
|
</when>
|
|
|
- <when test="isDxFlag">
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
|
|
|
|
|
- and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
|
|
|
|
|
- #{orderQueryVo.userId} )
|
|
|
|
|
- </if>
|
|
|
|
|
|
|
+ <when test="type==2">
|
|
|
|
|
+ and dept.management_source=2
|
|
|
</when>
|
|
</when>
|
|
|
- <otherwise>
|
|
|
|
|
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
|
|
|
|
|
- and io.userid = #{orderQueryVo.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- </otherwise>
|
|
|
|
|
</choose>
|
|
</choose>
|
|
|
- group by
|
|
|
|
|
- orderno, io.createtime
|
|
|
|
|
|
|
+ <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
|
|
|
|
|
+ and iac.signing_time >= #{orderQueryVo.signStartDateStr} AND iac.signing_time <![CDATA[ <= ]]> #{orderQueryVo.signEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
|
|
|
|
|
+ and io.entry_status = #{orderQueryVo.entryStatus }
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
|
|
|
|
|
+ and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
|
|
|
|
|
+ and iac.update_status = #{orderQueryVo.updateStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderQueryVo.partnerCompaniesId != null and orderQueryVo.partnerCompaniesId != null">
|
|
|
|
|
+ and agree.partner_companies_id = #{orderQueryVo.partnerCompaniesId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ and (io.del_flag = 0)
|
|
|
|
|
+ </where>
|
|
|
|
|
+ group by io.orderno,
|
|
|
|
|
+ iac.orderstatus,
|
|
|
|
|
+ iac.productid,
|
|
|
|
|
+ iac.product,
|
|
|
|
|
+ iac.jq_start_date,
|
|
|
|
|
+ iac.jq_end_date,
|
|
|
|
|
+ iac.sy_start_date,
|
|
|
|
|
+ iac.sy_end_date,
|
|
|
|
|
+ iac.jqpremium,
|
|
|
|
|
+ iac.sypremium,
|
|
|
|
|
+ iac.jypremium,
|
|
|
|
|
+ iac.taxamount,
|
|
|
|
|
+ iac.id,
|
|
|
|
|
+ d1.area_cname,
|
|
|
|
|
+ d2.area_cname,
|
|
|
|
|
+ d3.area_cname
|
|
|
order by io.createtime desc
|
|
order by io.createtime desc
|
|
|
|
|
+
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|