WHERE create_date = '${rq}'
${if(GETUSERDEPARTMENTS(3, 2) == "生产指挥中心", if(len(GETUSERDEPARTMENTS(3,2))==0,"and (1=1","", " and (host_department = '" + GETUSERDEPARTMENTS(3,2) + "'"),"")}
${if(find("生产指挥中心",GETUSERDEPARTMENTS())>0,"","and dept = '" + GETUSERDEPARTMENTS() + "'")}
使用find函数 可以直接获取部门 进行sql拼接
你第一个if缺少结束 ,"") 括号WHERE create_date = '${rq}'
${if(GETUSERDEPARTMENTS(3, 2) == "生产指挥中心", if(len(GETUSERDEPARTMENTS(3,2))==0,"and (1=1","", " and (department = '" + GETUSERDEPARTMENTS(3, 2) + "'"),"")}