<select id="selectUsers" resultType="map">
select
<include refid="Base_Column_List"/>
from sys_user
where status != 'DELETED'
<if test="name != null and name != ''">
and (phone like CONCAT('%',#{name},'%')
or account like CONCAT('%',#{name},'%')
or name like CONCAT('%',#{name},'%'))
</if>
<if test="deptId != null and deptId != 0">
and (dept_id = #{deptId} or dept_id in ( select dept_id from sys_dept where pids like CONCAT('%$[', #{deptId}, '$]%') escape '$' ))
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and (create_time between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
</select>