NutzCN Logo
问答 nutz 用mysql时候@在nutz是参数,到mysql语法时候就变成null
发布于 3050天前 作者 qq_305db03e 2001 次浏览 复制 上一个帖子 下一个帖子
标签: dao mysql

SELECT id,NAME,url,description,CASE WHEN @parent = m.parentid THEN @intlevel WHEN @parent < m.parentid THEN @intlevel := @intlevel + 1 ELSE @intlevel:=0 END AS LEVEL,FALSE AS EXPANDED,CASE WHEN m.parentid=0 then 0 ELSE 1 END AS ISLEAF FROM system_menu m ,(SELECT @intlevel := 0,@parent := 0) c $condition AND permissionid IN ($permissionIds)

最后变成的sql 是SELECT id,NAME,url,description,CASE WHEN NULL = m.parentid THEN NULL WHEN NULL < m.parentid THEN NULL := NULL + 1 ELSE NULL:=0 END AS LEVEL,FALSE AS EXPANDED,CASE WHEN m.parentid=0 then 0 ELSE 1 END AS ISLEAF FROM system_menu m ,(SELECT NULL := 0,NULL := 0) c WHERE 1=1 AND permissionid IN (01,2,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,2015,2016,101,117,118,119,120,121,122,123,124,125,1014,1801,1802,1803,1804,1805,1901,1902,1903,1904)'

1 回复

自定义sql?

@代表参数, $代表变量

如果不需要抹除, @ 写成 @@

添加回复
请先登陆
回到顶部