where判断如果放在最外层就是对连接查询后的结果经行筛选。
SELECT * from ( SELECT * from lw_area where lw_area.area_level <=3 and lw_area.area_id like '35%' ) la LEFT JOIN ( select * from t_cas_area_statistics t where 1=1 <if test="statist_date != null and statist_date != ''"> and t.statist_date = #{statist_date} </if> <if test="resource_type!=null and resource_type != ''"> and t.resource_type = #{resource_type} </if> ) t on la.area_id = t.area_code