• mybatis-puls常用全量配置以及开启sql日志(application.properties方式)


    1、开启sql日志

    #开启sql日志
    mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
    
    • 1
    • 2

    2、全量配置

    #===================== mybatis-plus配置 ===================== 
    #如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
    #如果是放在resource目录 classpath:/mapper/*Mapper.xml
    mybatis-plus.mapper-locations=classpath:/mapper/*/*Mapper.xml
    #别名包扫描,多个package用逗号或者分号分隔
    mybatis-plus.type-aliases-package=com.*.*.dao
    #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
    mybatis-plus.configuration.map-underscore-to-camel-case=true
    mybatis-plus.configuration.cache-enabled=false
    #配置JdbcTypeForNull, oracle数据库必须配置
    mybatis-plus.configuration.jdbc-type-for-null='null'
    #开启sql日志
    mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
    mybatis-plus.global-config.id-type=0
    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
    mybatis-plus.global-config.field-strategy=2
    #驼峰下划线转换
    mybatis-plus.global-config.db-column-underline=true
    #mp2.3+ 全局表前缀 t_
    mybatis-plus.global-config.table-prefix=ht_
    #刷新mapper 调试神器
    mybatis-plus.global-config.refresh-mapper=true
    #数据库大写下划线转换
    mybatis-plus.global-config.capital-mode=true
    #逻辑删除配置(下面3个配置)
    mybatis-plus.global-config.logic-delete-value=4
    mybatis-plus.global-config.logic-not-delete-value=0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
  • 相关阅读:
    预发部署时机器总是重启两次的“简单”排查
    聊聊druid的borrow行为
    10月工作经验总结
    Scratch软件编程等级考试四级——20210626
    golang 爬虫修炼04 ---利用正则提取数据
    python报错系列(14)--Selenium support for PhantomJS has been deprecated
    matlab写shpfile文件(字段名改为中文)
    使用 Crontab 自动化任务调度
    Spring框架注解大全
    Centos安装RabbitMQ超详细(必须收藏)
  • 原文地址:https://blog.csdn.net/csdn_avatar_2019/article/details/126128930