0
点赞
收藏
分享

微信扫一扫

MyBatis: $的用法(字符串直接替换)

高子歌 2022-07-27 阅读 144


  1. Mapper

@Select("select * from book where id=${id}")
Book selectBook(@Param("id") int id);

@Select("select * from book where bookName=${yyy}")
Book selectBook2(@Param("yyy") String yyy);

2.调用

Book book=xingmingMapper.selectBook(1);
System.out.println(book);

Book book2=xingmingMapper.selectBook2("'cppp'");
System.out.println(book2);


举报

相关推荐

0 条评论