根据控件传入不同的值,查询不同的部门树出现问题

根据收入确认年份改变部门树,传入p_depart_type的值。单独执行树的sql也可以,就是关联查询的时候报错。请问如何解决,谢谢。image.pngsqlimage.pngtreeimage.pngdepartTree

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)}

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;

FineReport 用户tTPzn6691 发布于 2021-2-26 18:19
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
取消
  • 1关注人数
  • 351浏览人数
  • 最后回答于:2021-2-26 18:19
    请选择关闭问题的原因
    确定 取消
    返回顶部