目标:显示所有末级节点
思路:
根据父节点count数,判断是否有子节点
源码sql
select t."CLASS_CODE",t."CLASS_NAME",t."FATHER_CLASS_CODE",t."CLASS_STATE",t."OP_USER",t."OP_TIME",t."IS_PROJECT",nvl(t2.isParent,0) isParent from FSS_PROJECT_CLASS t LEFT JOIN ( SELECT count(1) isParent,FATHER_CLASS_CODE from FSS_PROJECT_CLASS GROUP BY FATHER_CLASS_CODE ) t2 on t.CLASS_CODE = T2.FATHER_CLASS_CODE;
根据isParent就可以判断所有的末级节点
where isParent=0;
就ok了。
时间: 2024-10-18 15:59:14