|
|
@@ -188,42 +188,55 @@
|
|
|
esm_ins_company AS eic
|
|
|
LEFT JOIN ptl_agreement AS pa ON pa.insurance_company_id = eic.id
|
|
|
LEFT JOIN esm_ins_company eic_hz ON pa.partner_companies_id = eic_hz.id
|
|
|
- left join sys_area area on RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0)= area.area_code
|
|
|
+ left join sys_area area on RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0)= area.area_code
|
|
|
<where>
|
|
|
- 1=1
|
|
|
- and pa.id is not null
|
|
|
- <if test="vo.deptId !=null and vo.deptId !=''" >
|
|
|
- AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id LIKE concat(#{vo.deptId},'%') )
|
|
|
- </if>
|
|
|
- <if test="vo.warningDay !=null and vo.warningDay !=''" >
|
|
|
- <choose>
|
|
|
- <when test="warningDay==1">
|
|
|
- DATEDIFF(pa.end_date,NOW()) <= 30
|
|
|
- </when>
|
|
|
- <when test="warningDay==2">
|
|
|
- DATEDIFF(pa.end_date,NOW()) <= 60
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- <if test="vo.warningStatus !=null and vo.warningStatus !=''" >
|
|
|
- <choose>
|
|
|
- <when test="warningStatus==1">
|
|
|
- DATEDIFF(pa.end_date,NOW()) <= 30
|
|
|
- </when>
|
|
|
- <when test="warningStatus==2">
|
|
|
- DATEDIFF(pa.end_date,NOW()) > 30
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- <if test="vo.areaId !=null and vo.areaId !=''" >
|
|
|
- AND ( pa.companies_type = 1 AND RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0) = #{vo.areaId})
|
|
|
- </if>
|
|
|
- <if test="vo.partnerCompaniesId !=null and vo.partnerCompaniesId !=''" >
|
|
|
- and pa.partner_companies_id =#{vo.partnerCompaniesId}
|
|
|
- </if>
|
|
|
- <if test="vo.insuranceCompanyId !=null and vo.insuranceCompanyId !=''" >
|
|
|
- and pa.insurance_company_id =#{vo.insuranceCompanyId}
|
|
|
- </if>
|
|
|
+ 1=1
|
|
|
+ and pa.id is not null
|
|
|
+ <if test="vo.deptId !=null and vo.deptId !=''">
|
|
|
+ AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id LIKE
|
|
|
+ concat(#{vo.deptId},'%') )
|
|
|
+ </if>
|
|
|
+ <if test="vo.warningDay !=null and vo.warningDay !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="warningDay==1">
|
|
|
+ DATEDIFF(pa.end_date,NOW()) <= 30
|
|
|
+ </when>
|
|
|
+ <when test="warningDay==2">
|
|
|
+ DATEDIFF(pa.end_date,NOW()) <= 60
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="vo.warningStatus !=null and vo.warningStatus !=''">
|
|
|
+ <choose>
|
|
|
+ <when test="warningStatus==1">
|
|
|
+ DATEDIFF(pa.end_date,NOW()) <= 30
|
|
|
+ </when>
|
|
|
+ <when test="warningStatus==2">
|
|
|
+ DATEDIFF(pa.end_date,NOW()) > 30
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="vo.areaId !=null and vo.areaId !=''">
|
|
|
+ AND ( pa.companies_type = 1 AND RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0) = #{vo.areaId})
|
|
|
+ </if>
|
|
|
+ <if test="vo.partnerCompaniesId !=null and vo.partnerCompaniesId !=''">
|
|
|
+ and pa.partner_companies_id =#{vo.partnerCompaniesId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.insuranceCompanyId !=null and vo.insuranceCompanyId !=''">
|
|
|
+ and pa.insurance_company_id =#{vo.insuranceCompanyId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.provinceId != null and vo.provinceId != ''">
|
|
|
+ and pa.dept_id like concat('%',#{vo.provinceId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.cityId != null and vo.cityId != ''">
|
|
|
+ and pa.dept_id like concat('%',#{vo.cityId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.countyId != null and vo.countyId != ''">
|
|
|
+ and pa.dept_id like concat('%',#{vo.countyId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="vo.houseId != null and vo.houseId != ''">
|
|
|
+ and pa.dept_id like concat('%',#{vo.houseId},'%')
|
|
|
+ </if>
|
|
|
</where>
|
|
|
ORDER BY
|
|
|
pa.serial_number
|