想法项目中如何使用SpringBoot + MyBatis-Plus的方法?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
1。打开的想法
2.文件→新建→项目
3。选择春天initializr→下一个
4。填写Grouphe和工件,选择Java版本:8点击下,如图:
5。选择对应的依赖,点击下
6。核对项目的名字是否一致,点击结束后就完成了工程的创建。
7。接下来就是pom文件的依赖包引入了(很重要的! ! !)
& lt; dependency> & lt; groupId> org.springframework.boot & lt; artifactId> spring-boot-starter-jdbc & lt;/dependency> & lt; dependency> & lt; groupId> org.springframework.boot & lt; artifactId> spring-boot-starter-web & lt;/dependency> & lt; dependency> & lt; groupId> com.alibaba & lt; artifactId> fastjson & lt; version> 1.2.73 & lt;/dependency> & lt; dependency> & lt; groupId> org.springframework.boot & lt; artifactId> spring-boot-starter-aop & lt;/dependency> & lt; dependency> & lt; groupId> com.oracle & lt; artifactId> ojdbc6 & lt; version> 11.2.0.4.0-atlassian-hosted & lt;/dependency> & lt; !——orail8n字符集——比; & lt; dependency> & lt; groupId> cn.easyproject & lt; artifactId> orai18n & lt; version> 11.2.0.4 & lt;/dependency> & lt; !——mybatis +比; & lt; dependency> & lt; groupId> com.baomidou & lt; artifactId> mybatis-plus-boot-starter & lt; version> 3.3.1.tmp & lt;/dependency> & lt; !——代码生成——比; & lt; dependency> & lt; groupId> com.baomidou & lt; artifactId> mybatis-plus-generator & lt; version> 3.3.0 & lt;/dependency> & lt; !——代码生成模板——比; & lt; dependency> & lt; groupId> org.apache.velocity & lt; artifactId> velocity-engine-core & lt; version> 2.2 & lt;/version> & lt;/dependency> & lt; !——大摇大摆的在 & lt; dependency> & lt; groupId> io.springfox & lt; artifactId> springfox-swagger2 & lt; version> 2.9.2 & lt;/dependency> & lt; dependency> & lt; groupId> io.springfox & lt; artifactId> springfox-swagger-ui & lt; version> 2.9.2 & lt;/dependency> & lt; !——lombok祝辞 & lt; dependency> & lt; groupId> org.projectlombok & lt; artifactId> lombok & lt; version> 1.18.12 & lt;/dependency>
8。在appliaction。propertiles配置文件中写入数据库参数
spring.datasource.url=jdbc: oracle:薄:@localhost: 1521:李艾科 spring.datasource.username=用户 spring.datasource.password=密码 spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
9。在Java下创建对应的pojo和映射器包,并创建对应的类
10。在pojo包中新建和数据库用户信息表映射的类
@ data @KeySequence (“SEQ_USER_INFO") 公开课用户信息{ @TableId (value=https://www.yisu.com/zixun/癠SER_ID类型=IdType.INPUT)//在自增主键的变量加上即可 私人长标识; 私人字符串的用户名; @TableField (value=" USER_NINAME ")//可以不写,但字段名要用小驼峰命名 私人字符串userNiName; 私人字符串userPwd; 私人userCtime日期; 私人整数userState; 私人整数userSex; 私人字符串userEdu; 私人字符串userPro; 私人字符串userEmail; 私人字符串userTel; 私人长userScore; }想法项目中如何使用SpringBoot + MyBatis-Plus的方法