@Select("<script>SELECT s.* ,t.userName AS createbyName " +
"FROM " +
"st_user s ,st_user t " +
"WHERE s.createby = t.id " +
"<if test=\"userName !=null and userName!=''\"> and s.userName LIKE CONCAT('%',#{userName},'%')</if>" +
"<if test=\"userCode !=null and userCode!=''\"> and s.userCode LIKE CONCAT('%',#{userCode},'%')</if>" +
"<if test=\"sex !=3 \"> and s.sex=#{sex}</if></script>")
mybatis 注解动态sql
最新推荐文章于 2024-04-28 22:19:56 发布
本文详细介绍了如何在MyBatis中使用动态SQL语句,包括if条件判断和变量拼接,展示了如何根据不同的参数动态生成SQL查询。
1238

被折叠的 条评论
为什么被折叠?



