MyBatis的Mapper接口以及Example的实例函数及详解,用案例源码解析EventLoopGroup

本文详细介绍了MyBatis的Mapper接口及其Example类的使用,包括insert、selectByPrimaryKey、updateByPrimaryKey等方法,以及如何通过Example进行条件查询。同时,文章提供了应用示例,如按条件查询、排序等,帮助理解MyBatis的动态SQL功能。
摘要由CSDN通过智能技术生成

| String/Integer insert(User record) thorws SQLException | 插入数据(返回值为ID) |

| User selectByPrimaryKey(Integer id) thorws SQLException | 按主键查询 |

| ListselectByExample(UserExample example) thorws SQLException | 按条件查询 |

| ListselectByExampleWithBLOGs(UserExample example) thorws SQLException | 按条件查询(包括BLOB字段)。只有当数据表中的字段类型有为二进制的才会产生。 |

| int updateByPrimaryKey(User record) thorws SQLException | 按主键更新 |

| int updateByPrimaryKeySelective(User record) thorws SQLException | 按主键更新值不为null的字段 |

| int updateByExample(User record, UserExample example) thorws SQLException | 按条件更新 |

| int updateByExampleSelective(User record, UserExample example) thorws SQLException | 按条件更新值不为null的字段 |

二、example实例解析

mybatis的逆向工程中会生成实例及实例对应的example,example用于添加条件,相当where后面的部分

xxxExample example = new xxxExample();

Criteria criteria = new Example().createCrite

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值