参考视频基于EasyCode插件的Spring boot、Mybatis框架快速整合搭建以及PostMan的使用 点击观看文章目录1 创建项目pom.xml2 创建数据库3 导包pom.xml4 配置application.yaml文件5 使用插件EasyCode6 验证项目是否运行成功7 使用PostMan测试工具测试接口1 创建项目pom.xml?xml version1.0 encodingUTF-8?projectxmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.5.6/versionrelativePath/!-- lookup parent from repository --/parentgroupIdcom.findx/groupIdartifactIdspringboot-mybatis-demo/artifactIdversion0.0.1-SNAPSHOT/versionnamespringboot-mybatis-demo/namedescriptionspringboot-mybatis-demo/descriptionurl/licenseslicense//licensesdevelopersdeveloper//developersscmconnection/developerConnection/tag/url//scmpropertiesjava.version1.8/java.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build/project2 创建数据库createdatabasemalldbdefaultcharactersetutf8mb4collateutf8mb4_unicode_ci;# 使用数据库usemalldb;-- 建表sqlcreatetablemall_user(idintauto_incrementcomment主键idprimarykey,user_idbigintdefault0nullcomment用户id,user_namevarchar(8)defaultnullcomment用户姓名,user_genderintdefault0nullcomment性别,user_addressvarchar(256)defaultnullcomment用户地址,user_birthdaytimestampdefaultCURRENT_TIMESTAMPnullcomment用户生日,user_phonevarchar(20)defaultnullcomment用户手机号,create_timetimestampdefaultCURRENT_TIMESTAMPnullCOMMENT创建时间,update_timetimestampdefaultCURRENT_TIMESTAMPnullONupdateCURRENT_TIMESTAMPCOMMENT更新时间)comment用户表;-- 建立唯一索引createuniqueindexidx_user_idonmall_user(user_id);-- 插入数据INSERTINTOmall_user(user_id,user_name,user_gender,user_address,user_birthday,user_phone,create_time,update_time)VALUES(88880001,zs,1,sh,DEFAULT,15821238534,DEFAULT,DEFAULT);INSERTINTOmall_user(user_id,user_name,user_gender,user_address,user_birthday,user_phone,create_time,update_time)VALUES(88880002,ls,0,bj,DEFAULT,15821238588,DEFAULT,DEFAULT);INSERTINTOmall_user(user_id,user_name,user_gender,user_address,user_birthday,user_phone,create_time,update_time)VALUES(88880003,ww,1,sh,DEFAULT,15821238577,DEFAULT,DEFAULT);# 查看数据库select*frommall_user;3 导包pom.xml?xml version1.0 encodingUTF-8?projectxmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.5.6/versionrelativePath/!-- lookup parent from repository --/parentgroupIdcom.findx/groupIdartifactIdspringboot-mybatis-demo/artifactIdversion0.0.1-SNAPSHOT/versionnamespringboot-mybatis-demo/namedescriptionspringboot-mybatis-demo/descriptionurl/licenseslicense//licensesdevelopersdeveloper//developersscmconnection/developerConnection/tag/url//scmpropertiesjava.version1.8/java.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency!--mybatis--dependencygroupIdorg.mybatis.spring.boot/groupIdartifactIdmybatis-spring-boot-starter/artifactIdversion2.3.2/version/dependency!--mysql驱动--dependencygroupIdcom.mysql/groupIdartifactIdmysql-connector-j/artifactIdversion8.0.31/version/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build/project4 配置application.yaml文件spring:datasource:url:jdbc:mysql://localhost:3306/malldb?useUnicodetruecharacterEncodingutf-8useSSLfalseallowPublicKeyRetrievaltrueserverTimezoneAsia/Shanghaiusername:rootpassword:rootdriver-class-name:com.mysql.cj.jdbc.Driver5 使用插件EasyCode6 验证项目是否运行成功7 使用PostMan测试工具测试接口