1、注意事项:
垂直分类查询控件需要包含父字段的树结构数据集,而且必须有根节点。如有需要隐藏首层节点,
构造数据库视图的时候,判断如果是二级节点,则把PID设置成
00000000-0000-0000-0000-000000000000
CREATE view [dbo].[yq_productfiles] as select case when len(levelcode)=20 then (select cname from ProductClassInfo where ProductClassInfoOID=(select ProductClassInfo_FK from ProductClassInfo where ProductClassInfoOID=(select ProductClassInfo_FK from ProductClassInfo where ProductClassInfoOID =info.ProductClassInfo_FK) )) when len(levelcode)=15 then (select cname from ProductClassInfo where ProductClassInfoOID=(select ProductClassInfo_FK from ProductClassInfo where ProductClassInfoOID=info.ProductClassInfo_FK)) when len(levelcode)=10 then (select cname from ProductClassInfo where ProductClassInfoOID=info.ProductClassInfo_FK) end as fenchang, ProductClassInfoOID, ccode, cname, ddate, cmaker, levelcode, picutre, ProductCoding, case when len(levelcode)=10 then '00000000-0000-0000-0000-000000000000' else ProductClassInfo_FK end as 'ProductClassInfo_FK' from ProductClassInfo info where len(levelcode) <>5 GO