赞
踩
基于SpringBoot的增删改查的小项目。
CREATE TABLE `staff` ( `s_id` int(5) NOT NULL AUTO_INCREMENT COMMENT '员工主键', `s_name` varchar(10) DEFAULT NULL COMMENT '员工姓名', `s_phone` varchar(11) DEFAULT NULL COMMENT '员工电话号', `s_number` varchar(18) DEFAULT NULL COMMENT '身份证号', PRIMARY KEY (`s_id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; /*Data for the table `staff` */ insert into `staff`(`s_id`,`s_name`,`s_phone`,`s_number`) values (1,'王晓明','130****5585','4886********0000'), (2,'张东志','130****9999','4886********9999'), (3,'吴晓','130****5555','4325********4455'), (4,'刘慧','130****5556','4377********4265'), (6,'武动','130****5558','4886********5568'), (7,'黑信','130****5559','4206********8877'), (8,'王潇','130****5560','4386********6666'), (9,'灰岁','130****5544','4306********3333'), (10,'王戊戌','130****5533','4396********9999'), (11,'许四星','130****5522','5306********7777'), (16,'张','1234567891','4444');
application.properties
#################### #数据库四要素 #spring.datasource.url=jdbc:mysql://localhost:3306/mydb?charaterEncoding=utf-8&serverTimezone=UTC # [ ] # 上面这个位置填写数据库名字 #################### spring.datasource.url=jdbc:mysql://localhost:3306/mydb?charaterEncoding=utf-8&serverTimezone=UTC spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver ##################### #下面填写自己的数据库名字 ##################### spring.datasource.username=root ##################### #这里是密码 ##################### spring.datasource.password=root #################### #JPA设置 #################### spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.show_sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.database=mysql spring.jpa.properties.hibernate.enable.enable_lazy_load_no_trans=true ######################### #模板缓存关闭 ######################### spring.thymeleaf.cache=false ########################## #mybatis设置 ########################## #配置别名(统一配置包中所有实体类的别名,别名为类的简单别名) mybatis.type-aliases-package=com.newture.entity #配置映射文件的位置 mybatis.mapper-locations=classpath:mapper/*.xml
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.4.5</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.newture</groupId> <artifactId>springboot-pagehelper</artifactId> <version>0.0.1-SNAPSHOT</version> <name>springboot-pagehelper</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <!----> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。