访客登录(提问者)根据提供的思路,写了这个语句,测试有效,感谢提供思路
SELECT distinct type
FROM 主数据
WHERE 1=1
${if(len(SQL(\"sql\" , \"SELECT 1 FROM 权限
where user_id = \'\" + userid +\"\'\" , 1 ,1)) = 0 , \"\" , \"and type in (select type FROM 权限 WHERE user_id = \'\" + userid + \"\')\")}