mybatis-plus 是一款 mybatis 动态 SQL 自动注入 mybatis 增删改查 CRUD 操作中间件。让 mybatis 拥有 hibernate 的单表高效,也保留 xml sql 的灵动, 减少你的开发周期优化动态维护 xml 实体字段,您再也不要羡慕不需要纠结是选择 hibernate 还是 jpa 呢?请记住还有 MP 2018 不容错过。 代号:怀念 , 纪念 2017 baomidou 组织小伙伴 MP 共同成长之路,奔向 2018 旺旺旺,再次感谢 OSC @红薯、感谢 baomidou 组织所有基友们。 升级日志:
// 不进行 count sql 优化 page.setOptimizeCountSql(false);
例如:@TableField(.. , update="%s+1") 其中 %s 会填充为字段 输出 SQL 为:update 表 set 字段=字段+1 where ... 例如:@TableField(.. , update="now()") 使用数据库时间 输出 SQL 为:update 表 set 字段=now() where ...
@TableField(condition = SqlCondition.LIKE) private String name; 输出 SQL 为:select 表 where name LIKE CONCAT('%',值,'%')
strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略 strategy.setColumnNaming(NamingStrategy.underline_to_camel);// 允许字段策略独立设置,默认为 naming 策略
// 选择 freemarker 引擎 mpg.setTemplateEngine(new FreemarkerTemplateEngine());
# 开启 SQL 解析缓存注解生效 mybatis-plus: global-config: sql-parser-cache: true
|