随笔分类 - mybatis
摘要:1.pom.xml引入mybatis-plus协议 <!-- mybatisPlus 核心库 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <ve
阅读全文
摘要:1.idea安装mybatis-generator插件 2.在pom.xml引入协议 <dependencies> <!-- Mybatis 生成工具 --> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>myba
阅读全文
摘要:server层: Wrapper<Ship> wrapper = new EntityWrapper<>();//条件类 wrapper.where("user_id={0}",uid);//增加条件 Page<Ship> shipPage = new Page<>(pageNum, pageSiz
阅读全文
摘要:xml <insert id="insertForId" useGeneratedKeys="true" keyProperty="id"> insert into student(sname,sage,ssex) VALUES (s.name,s.sage,s.ssex) </insert> Ma
阅读全文
摘要:效果:在字段上加上这个注解再执行BaseMapper的删除方法时,删除方法会变成修改 例: 实体类: @TableLogic private Integer del; service层: 调用BaseMapper的deleteById(id); 执行是效果: 加@TableLogic的情况下 走 U
阅读全文
摘要:1.特性: 1.无侵入:引入mybatis-plus不会对mybatis框架产生任何影响因为他是在mybatis的基础上进行了扩展 2.依赖少:仅仅依赖mybatis和mybatis-Spring 3.损耗小:启动会自动注入基本的curd(增删改查)操作性能基本无损耗直接面向对象操作 4.预防sql
阅读全文
摘要:1.优点: 1:与JDBC相比减少了50%的代码 2:是最简单的持久化框架 3:Sql代码从程序中彻底分离 4:提供xml标签支持sql动态 5:提供映射标签支持对象与数据库的ORM字段映射 2.缺点: 1.sql语句编写工作量大 2.数据库移至性差 3.基本要素: 4.MyBatis核心对象生存周
阅读全文
摘要:Mybatis是ORM(Object/Relational/Mapping)类型的; 对象/关系/映射 Mybatis是数据持久化技术在对象模型和关系数据库之间建立起对应的关系,并且提供了一种机制叫JavaBean对象操作数据库表中数据。 纯接口开发规范: 1.映射文件的Mapper标签的names
阅读全文