select * from dbo.student
where 1=1 ${if(len(stuName)==0,"","and stuName='"+stuName+"'")}
${if(len(stuNo)==0,"","and stuNo='"+stuNo+"'")}
--使用len()方法判断参数的值是否为空,如果为空则添加连接空字符串
--否则读取相应的参数值,进行查询,可实现多条件的添加
select * from dbo.student
where 1=1 ${if(len(stuName)==0,"","and stuName='"+stuName+"'")}
${if(len(stuNo)==0,"","and stuNo='"+stuNo+"'")}
--使用len()方法判断参数的值是否为空,如果为空则添加连接空字符串
--否则读取相应的参数值,进行查询,可实现多条件的添加