mybatis plus使用筆記

引入依賴

<dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>

配置文件

mybatis-plus:
  mapper-locations: mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

啓動類中加入

@MapperScan("com.xxx.xxx.xxx.mapper")  
//mapper接口所在的包名

查詢條件

條件 作用 格式
eq 等於 = new QueryWrapper.eq(“字段”,val)
ne 不等於 QueryWrapper<表名> 對象 = new QueryWrapper(); 對象.ne(“字段”,val)
gt 大於
ge 大於等於
lt 小於
le 小於等於
betwen 在…之間 兩端都包含,相當於左邊<=字段<=右邊
noBetween 不在…之間
like 模糊匹配
noLike
likeLeft
likeRight
isNull
isNotNull
in
notLn
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章