2022年7月7日 星期四

MyBatis中文网文档

MyBatis中文网
https://mybatis.net.cn/

MyBatis-Plus官方文档

MyBatis-Plus
https://baomidou.com/

MyBatis 教程_w3cschool

https://www.w3cschool.cn/mybatis/

其他文档

mybatis详解(全)Ferao的博客-CSDN博客mybatis
https://blog.csdn.net/qq_21561501/article/details/123649171

逻辑删除

逻辑删除,在字段上加上注解(@TableLogic)

判空

查询时判断条件是否不为空,在实体中添加下面注解

@TableField(whereStrategy = FieldStrategy.NOT_EMPTY)

注解自动填充属性

实体类中有如下属性,通过注解自动填充属性

  • 插入数据时,自动填充属性
    @TableField(fill = FieldFill.INSERT)
  • 更新数据时,自动填充属性
    @TableField(fill = FieldFill.UPDATE)
  • 插入或更新数据时,自动填充属性
    @TableField(fill = FieldFill.INSERT_UPDATE)
  • 更新数据时,忽略字段
    @TableField(updateStrategy = FieldStrategy.NEVER)
  • 更新数据时,填充值
    @TableField(update = "now()")
作者:李世民  创建时间:2022-07-07 12:53
最后编辑:李世民  更新时间:2022-08-15 14:30