根据收入确认年份改变部门树,传入p_depart_type的值。单独执行树的sql也可以,就是关联查询的时候报错。请问如何解决,谢谢。 select a.uuid, a.parent_uuid, concat(a.name,'(',a.code,')') name, a.code -- 视图里可以限制哪些部门不展示 from ${if(p_depart_type=year(today()) || p_depart_type=null, "vi_inventory_tree", "vi_inventory_tree_"+p_depart_type)} a left join (select aa.* from ${if(p_depart_type=year(today()) || p_depart_type=null, "tm_inventory", "tm_inventory_"+p_depart_type)} aa left join ${if(p_depart_type=year(today()) || p_depart_type=null, "tm_priv_inventory", "tm_priv_inventory_"+p_depart_type)} bb on aa.uuid=bb.inventory_id left join tm_user cc on cc.uuid=bb.user_id where cc.account=${"'"+loginuser+"'"}) b on a.dn_no = b.dn_no where a.state=1 ${if(hierarchy<1, " and 1=1 "," and b.code is not null ")} order by a.hierarchy, a.priority; |