and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
<iftest="businessType !=null and businessType !=''">
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
<iftest="businessType !=null and businessType !=''">
a.sequence_nbr as sequenceNbr,application_unit_name as unitName,inspection_unit_name as receiveOrgName,application_date as createDate,accept_date as handleDate
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
<iftest="dto.companyName != null and dto.companyName != ''">
and application_unit_name like CONCAT('%', #{dto.companyName}, '%')
</if>
<iftest="dto.superviseUnitName != null and dto.superviseUnitName != ''">
and inspection_unit_name like CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<iftest="businessType !=null and businessType !=''">