随笔分类 -  mybayis/mybatis-plus

摘要:抽取可重用的sql片段 抽取:<sql id="xx"></sql> 使用:<include refid="xx"></inculde> <select id="getEmpsByDid" resultType="com.atguigu.mybatis.beans.Employee"> <inclu 阅读全文
posted @ 2021-03-26 11:03 至安 阅读(265) 评论(0) 推荐(0)
摘要:1. 单个参数(基本类/包装类+String) 这种情况MyBatis可直接使用这个参数,不需要经过任何处理。 一个参数情况下#{}中内容随便写 public Employee getEmployeeById(Integer id ); <select id="selectEmployee" res 阅读全文
posted @ 2021-01-22 16:56 至安 阅读(418) 评论(0) 推荐(0)
摘要:引入依赖 <!-- velocity 模板引擎, Mybatis Plus 代码生成器需要 --> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> </ 阅读全文
posted @ 2020-12-29 14:37 至安 阅读(629) 评论(0) 推荐(0)
摘要:查询的几种情况 // 1)查询单行数据返回单个对象 public Employee getEmployeeById(Integer id ); // 2) 查询多行数据返回对象的集合 public List<Employee> getAllEmps(); // 3) 查询单行数据返回Map集合 pu 阅读全文
posted @ 2020-12-06 20:28 至安 阅读(2926) 评论(0) 推荐(0)