Mybatis 使用@select 模糊查询

@select 模糊查询

有时候我们写简单的SQL不想使用XML里面写。。所以我们可能直接一个注解搞定。

但是用常规的写法有点问题,报错。。所以我们这么写。。

@Select(" select id, banner_context,banner_img_src,banner_create_time,banner_is_use from sys_banner where is_del = "+SystemVariable.IS_NOT_DEL+" and banner_context  LIKE  CONCAT('%',#{0},'%')  ")
List<Resp_Banner> showSysBannerNotDel(String bannerContext);

就是这样就ok了。

发布了56 篇原创文章 · 获赞 121 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/qq_37857921/article/details/104268921
今日推荐