学习笔记——Mybatis动态SQL
2023-01-12
一、Mybatis动态SQL
即将SQL动态化
同时Mybatis的动态SQL支持OFNL表达式,OGNL(Object Graph Navigation Language)对象图导航语言。
1、先搭建环境
(1)创建一个“maven”模块,命名为“day04_mybatis”
(2)在“day04_mybatis”中的“pom.xml”中的<project>标签内部添加依赖,即添加jar包
<dependencies> <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.26</version> </dependency> <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.5.6</version> </dependency> <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/log4j/log4j --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> </dependencies>