r.check_category,r.check_css,r.is_complaint,r.create_time from enforcement_registration r
left join (select * from enterprise_information group by enterprise_number order by is_delete asc) i on r.enterprise_number=i.enterprise_number
<where>
and r.bureau_dept_name is not null
and r.law_enforcement_id is not null
and r.enterprise_name is not null
and r.enterprise_number is not null
and r.law_enforcer is not null
and r.law_enforcer_two is not null
and r.is_complaint is not null
and r.check_category is not null
and r.bureau_dept_id is not null
<iftest="qy != null and qy != ''">
<iftest="qy!='光明区'.toString()">and i.enterprise_address like concat('深圳市',#{qy}, '%')</if>
<iftest="qy=='光明区'.toString()">and( i.enterprise_address like concat('深圳市',#{qy}, '%')or i.enterprise_address like '深圳市光明新区%')</if>
<iftest="jd != null and jd != ''">
<iftest="qy!='光明区'.toString()">and i.enterprise_address like concat('深圳市',#{qy},#{jd}, '%')</if>
<iftest="qy=='光明区'.toString()">and( i.enterprise_address like concat('深圳市光明区',#{jd}, '%')or i.enterprise_address like concat('深圳市光明新区',#{jd}, '%'))</if>
</if>
</if>
<iftest="deptQx != null and deptQx != ''">and r.bureau_dept_id =#{deptQx}</if>
<iftest="lawEnforcement != null and lawEnforcement != ''"> and r.law_enforcement like concat('%', #{lawEnforcement}, '%')</if>
<iftest="bureauDeptName != null and bureauDeptName != ''"> and r.bureau_dept_name like concat('%', #{bureauDeptName}, '%')</if>
<iftest="enterpriseName != null and enterpriseName != ''"> and r.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<iftest="lawEnforcer != null and lawEnforcer != ''"> and (r.law_enforcer like concat('%',#{lawEnforcer} ,'%') or r.law_enforcer_two like concat('%',#{lawEnforcer} ,'%'))</if>
<iftest="isComplaint != null "> and r.is_complaint = #{isComplaint}</if>
<iftest="uniteCheck == '0'.toString()"> and r.unite_check is not null</if>
<iftest="uniteCheck == '1'.toString()"> and r.unite_check is null</if>
<iftest="enforce == '0'.toString()"> and r.check_css is not null</if>
<iftest="enforce == '1'.toString()"> and r.check_css is null</if>
<iftest="checkCategory != null and checkCategory != ''"> and r.check_category = #{checkCategory}</if>
<iftest="checkCss != null and checkCss != ''"> and r.check_css = #{checkCss}</if>
<iftest="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
and DATE_FORMAT(r.create_time,'%Y-%m-%d') >= STR_TO_DATE(#{beginTime},'%Y-%m-%d')
</if>
<iftest="endTime != null and endTime != ''"><!-- 结束时间检索 -->
and DATE_FORMAT(r.create_time,'%Y-%m-%d') <= STR_TO_DATE(#{endTime},'%Y-%m-%d')
</if>
<iftest="year != null and year != ''">
AND YEAR(r.create_time) = #{year}
</if>
<iftest="quarter != null and quarter != '' ">
AND QUARTER(r.create_time) = #{quarter}
</if>
<iftest="month != null and month != '' ">
AND DATE_FORMAT(r.create_time, '%Y-%m') = #{month}
r.check_category,r.check_css,r.is_complaint,r.create_time,substring(i.enterprise_address,4,INSTR(i.enterprise_address, '区')-3)as qy,substring(i.enterprise_address,INSTR(i.enterprise_address, '区')+1,INSTR(i.enterprise_address, '街道')-INSTR(i.enterprise_address, '区')+1)as jd from enforcement_registration r
left join (select * from enterprise_information group by enterprise_number order by is_delete asc) i on r.enterprise_number=i.enterprise_number
<where>
<iftest="uniteCheck != null and uniteCheck != ''">