###记录
1.直接SQL查询语句
select * from s_users where id =:userId
2.表达式SQL拼接
${
if(param("userId") == null) || param("userId")==''){
return "select * from s_users"
} else {
return "select * from s_users where id = :userId"
}
}
3.[:参数名
]的方式传递参数,模糊查询不能使用
${
"select * from s_users where 1=1 " + (emptyparam("userId")==false ? " and id =:userId" : "")
}
4.使用函数【param("参数名")
】传递参数,模糊查询可以使用
${
"select * from s_users where 1=1 " + (emptyparam("usercode")==false ? "and usercode like \'%" + param("usercode") +"%\'" : "")
}