|  |  |  | 
|---|
|  |  |  | left join ard_towers t on t.id = c.tower_id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="towerId != null  and towerId != ''">and c.tower_id = #{towerId}</if> | 
|---|
|  |  |  | <if test="ip != null  and ip != ''">and c.ip = #{ip}</if> | 
|---|
|  |  |  | <if test="type != null  and type != ''">and c.type = #{type}</if> | 
|---|
|  |  |  | <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if> | 
|---|
|  |  |  | <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t | 
|---|
|  |  |  | WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) )) | 
|---|