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 ((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.inspection_type = 'DQJY'
and a.inspection_type = 'DQJY'
<iftest="dto.beginDate != null and dto.beginDate != ''">
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
</if>
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.accept_date as date),#{dto.endDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
</if>
</if>
<iftest="dto.companyName != null and dto.companyName != ''">
<iftest="dto.companyName != null and dto.companyName != ''">
and application_unit_name like CONCAT('%', #{dto.companyName}, '%')
and application_unit_name like CONCAT('%', #{dto.companyName}, '%')
select a.sequence_nbr as sequenceNbr,use_unit_name as unitName,receive_org_name as receiveOrgName,create_date as createDate,audit_pass_date as handleDate,a.audit_status as status from tzs_jg_scrap_cancel a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%')
select a.sequence_nbr as sequenceNbr,use_unit_name as unitName,receive_org_name as receiveOrgName,create_date as createDate,audit_pass_date as handleDate,a.audit_status as status from tzs_jg_scrap_cancel a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%')
and audit_status != '使用单位待提交'
<iftest="dto.beginDate != null and dto.beginDate != ''">
<iftest="dto.beginDate != null and dto.beginDate != ''">
and date_ge(CAST(a.audit_pass_date as date),#{dto.beginDate})
and (date_ge(CAST(a.audit_pass_date as date),#{dto.beginDate}) or date_ge(CAST(a.create_date as date),#{dto.beginDate}))
</if>
</if>
<iftest="dto.endDate != null and dto.endDate != ''">
<iftest="dto.endDate != null and dto.endDate != ''">
and date_le(CAST(a.audit_pass_date as date),#{dto.endDate})
and (date_le(CAST(a.audit_pass_date as date),#{dto.endDate}) or date_le(CAST(a.create_date as date),#{dto.endDate}))
</if>
</if>
<iftest="dto.companyName != null and dto.companyName != ''">
<iftest="dto.companyName != null and dto.companyName != ''">
and use_unit_name like CONCAT('%', #{dto.companyName}, '%')
and use_unit_name like CONCAT('%', #{dto.companyName}, '%')