inner join sys_dept s on e.law_enforcement_id=s.dept_id
inner join enterprise_information i on e.enterprise_number=i.enterprise_number
where find_in_set(#{deptId},s.ancestors) and (year(e.create_time)=#{year}) and (month(e.create_time)in(${month}))
<where>
<iftest="deptId != null and deptId != ''">and find_in_set(#{deptId},s.ancestors)</if>
<iftest="year != null and year != ''">and (year(e.create_time)=#{year})</if>
<iftest="month != null and month != ''">and (month(e.create_time)in(${month}))</if>
</where>
order by e.enterprise_name
</select>
@ -31,7 +35,11 @@
from enforcement_registration e
inner join sys_dept s on e.law_enforcement_id=s.dept_id
inner join enterprise_information i on e.enterprise_number=i.enterprise_number
where !find_in_set((select dept_id from sys_dept where dept_name="区"),s.ancestors) and (year(e.create_time)=#{year}) and (month(e.create_time)in(${month}))
<where>
and !find_in_set((select dept_id from sys_dept where dept_name="区"),s.ancestors)
<iftest="year != null and year != ''">and (year(e.create_time)=#{year})</if>
<iftest="month != null and month != ''">and (month(e.create_time)in(${month}))</if>