if(条件1,SQL1,IF(条件2,SQL2,SQL3))
---------------
简单例子 type_为 姓名时根据 name字段查询;type_为 班级 时根据 classno 字段查询;其它情况按course查询 (复杂的写法)
${if(type_=="姓名","SELECT * FROM STSCORE WHERE NAME LIKE '%"+name_+"%'",IF(type_=="班级","SELECT * FROM STSCORE WHERE classno LIKE '%"+name_+"%'","SELECT * FROM STSCORE WHERE course LIKE '%"+name_+"%'"))}
简单点的写法
SELECT * FROM STSCORE WHERE ${SWITCH(type_,"姓名","NAME","班级","classno",type_,"course")} LIKE '%"+name_+"%'