SELECT count(1) as num FROM "tzs_jg_change_registration_reform" where receive_company_org_code like CONCAT(#{orgCode}, '%') and audit_status != '使用单位待提交' and audit_status != '使用单位已撤回' and audit_status != '已作废' and audit_status != '已完成'
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.apply_date as date),#{dto.beginDate})
and date_ge(CAST(create_date as date),#{dto.beginDate})
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.apply_date as date),#{dto.endDate})
and date_le(CAST(create_date as date),#{dto.endDate})
</if>
union all
SELECT count(1) as num FROM "tzs_jg_change_registration_transfer" where receive_company_org_code like CONCAT(#{orgCode}, '%') and audit_status != '使用单位待提交' and audit_status != '使用单位已撤回' and audit_status != '已作废' and audit_status != '已完成'
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.apply_date as date),#{dto.beginDate})
and date_ge(CAST(create_date as date),#{dto.beginDate})
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.apply_date as date),#{dto.endDate})
and date_le(CAST(create_date as date),#{dto.endDate})
</if>
union all
SELECT count(1) as num FROM "tzs_jg_change_registration_unit" where receive_company_org_code like CONCAT(#{orgCode}, '%') and status != '使用单位待提交' and status != '使用单位已撤回' and status != '已作废' and status != '已完成'
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.apply_date as date),#{dto.beginDate})
and date_ge(CAST(apply_date as date),#{dto.beginDate})
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.apply_date as date),#{dto.endDate})
and date_le(CAST(apply_date as date),#{dto.endDate})
</if>
union all
SELECT count(1) as num FROM "tzs_jg_change_vehicle_registration_unit" where org_branch_code like CONCAT(#{orgCode}, '%') and status != '使用单位待提交' and status != '使用单位已撤回' and status != '已作废' and status != '已完成'
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.apply_date as date),#{dto.beginDate})
and date_ge(CAST(apply_date as date),#{dto.beginDate})
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.apply_date as date),#{dto.endDate})
and date_le(CAST(apply_date as date),#{dto.endDate})