当前位置: 首页 > wzjs >正文

手机网站建设liedns本人已履行网站备案信息

手机网站建设liedns,本人已履行网站备案信息,百度关键词竞价价格查询,建设网站公司哪好一,前提 从零开始创建一个项目,绑定了数据库 用到的技术栈:springBootmybatisPlusmysqlswaggermaven 二,创建项目步骤 1,创建项目 创建出来的项目结构如图所示 2,修改配置文件 因为我比较习惯yml语言&…

一,前提

从零开始创建一个项目,绑定了数据库

用到的技术栈:springBoot+mybatisPlus+mysql+swagger+maven

二,创建项目步骤

1,创建项目

在这里插入图片描述

在这里插入图片描述

创建出来的项目结构如图所示

在这里插入图片描述

2,修改配置文件

因为我比较习惯yml语言,这里我就使用yml

在这里插入图片描述

application.yml配置如下:

spring:datasource:url: jdbc:mysql://localhost:3306/testusername: rootpassword: ****driver-class-name: com.mysql.jdbc.Driverthymeleaf:prefix: classpath:/template/  #所有的动态页面打包后的位置suffix: .html  #添加后缀# mybatis-plus相关配置
mybatis-plus:# xml扫描,多个目录用逗号或者分号分隔(告诉 Mapper 所对应的 XML 文件位置)mapper-locations: classpath:mapper/*.xml# 以下配置均有默认值,可以不设置global-config:db-config:#主键类型 AUTO:"数据库ID自增" INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";id-type: auto#字段策略 IGNORED:"忽略判断"  NOT_NULL:"非 NULL 判断")  NOT_EMPTY:"非空判断"field-strategy: NOT_EMPTY#数据库类型db-type: MYSQLconfiguration:# 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射map-underscore-to-camel-case: true# 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段call-setters-on-nulls: true# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

3,引入相关依赖

在这个环节中,我多次启动失败都是因为版本太高,所以下面的依赖是我调整完之后,
可以正常启动的依赖配置。

<?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.6.1</version><relativePath/><!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>projectA</artifactId><version>0.0.1-SNAPSHOT</version><name>projectA</name><description>projectA</description><!-- jdk配置信息,最好加上,因为如果不加上,每次我启动一次项目,项目的jdk版本就变成19,然后一直报错,这个地方永久配置jdk--><properties><java.version>17</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- mybatisPlus 核心库 --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.1.0</version></dependency><!-- druid依赖 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.0</version></dependency><!-- swagger依赖 --><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>2.9.2</version></dependency><!-- mysql依赖 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.46</version></dependency><!-- lombok依赖 --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.2</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build</project>

4,准备表数据

这里我准备了四张表


CREATE TABLE `student` (`student_no` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '学号',`name` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '姓名',`sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '性别',`birthday` date DEFAULT NULL COMMENT '出生日期',`stu_class` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '班级',PRIMARY KEY (`student_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('101', '李军', '男', '1976-02-20', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('103', '陆君', '男', '1974-06-03', '95031');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('105', '匡明', '男', '1975-10-02', '95031');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('107', '王丽', '女', '1976-01-23', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('108', '曾华', '男', '1977-09-01', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('109', '王芳', '女', '1975-02-10', '95031');

CREATE TABLE `score` (`student_no` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '学号',`course_no` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '课程编号',`score` decimal(4,1) DEFAULT NULL COMMENT '分数',PRIMARY KEY (`student_no`,`course_no`),KEY `Cno` (`course_no`),CONSTRAINT `Score_ibfk_1` FOREIGN KEY (`student_no`) REFERENCES `student` (`student_no`),CONSTRAINT `Score_ibfk_2` FOREIGN KEY (`course_no`) REFERENCES `course` (`course_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;INSERT INTO test.score
(student_no, course_no, score)
VALUES('101', '3-105', 64.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('101', '6-166', 85.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('103', '3-105', 92.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('103', '3-245', 86.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('105', '3-105', 88.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('105', '3-245', 75.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('107', '3-105', 91.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('107', '6-166', 79.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('108', '3-105', 78.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('108', '6-166', 81.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('109', '3-105', 76.0);
INSERT INTO test.score
(student_no, course_no, score)
VALUES('109', '3-245', 68.0);

CREATE TABLE `student` (`student_no` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '学号',`name` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '姓名',`sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '性别',`birthday` date DEFAULT NULL COMMENT '出生日期',`stu_class` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '班级',PRIMARY KEY (`student_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('101', '李军', '男', '1976-02-20', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('103', '陆君', '男', '1974-06-03', '95031');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('105', '匡明', '男', '1975-10-02', '95031');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('107', '王丽', '女', '1976-01-23', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('108', '曾华', '男', '1977-09-01', '95033');
INSERT INTO test.student
(student_no, name, sex, birthday, stu_class)
VALUES('109', '王芳', '女', '1975-02-10', '95031');
CREATE TABLE `teacher` (`teacher_no` varchar(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,`name` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,`sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,`birthday` date DEFAULT NULL,`title` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,`depart` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,PRIMARY KEY (`teacher_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;INSERT INTO test.teacher
(teacher_no, name, sex, birthday, title, depart)
VALUES('804', '李诚', '男', '1958-12-02', '副教授', '计算机系');
INSERT INTO test.teacher
(teacher_no, name, sex, birthday, title, depart)
VALUES('825', '王萍', '女', '1972-05-05', '助教', '计算机系');
INSERT INTO test.teacher
(teacher_no, name, sex, birthday, title, depart)
VALUES('831', '刘冰', '女', '1977-08-14', '助教', '电子工程系');
INSERT INTO test.teacher
(teacher_no, name, sex, birthday, title, depart)
VALUES('856', '张旭', '男', '1969-03-12', '讲师', '电子工程系');

5,创建相关类

这里我推荐一个好用的插件mybatisX,可以自动创建相关类,很省事

在这里插入图片描述

先连接好数据库,刷新表

在这里插入图片描述

配置生成的类基本信息

在这里插入图片描述
在这里插入图片描述

都给我生成好了

在这里插入图片描述

6,相关注解添加

启动类处理一下


@SpringBootApplication
@MapperScan(basePackages = "com.example.mapper")
public class ProjectApplication {public static void main(String[] args) {try {SpringApplication.run(ProjectApplication.class, args);} catch (Exception e) {e.printStackTrace();}}
}

其他注解添加

在这里插入图片描述
在这里插入图片描述

7,项目可以安全启动了

在这里插入图片描述

8,其他文章

永久解决 Intellij idea 报错:Error : java 不支持发行版本5

Maven [ERROR] 不再支持源选项 5,请使用 7 或更高版本的解决办法

SpringBoot教程(十六) | SpringBoot集成swagger(全网最全)

SpringBoot集成swagger2报错‘apiDocumentationScanner‘ defined in URL

SpringBoot 整合MyBatisPlus

Error creating bean with name ‘**ServiceImpl‘: Unsatisfied dependency expressed through field ‘baseM

IDEA设置自动导入包

下班咯,还待完善,敬请期待。。。


文章转载自:

http://3DpdUipe.ktnmg.cn
http://GmpPleZp.ktnmg.cn
http://SWFF3m1n.ktnmg.cn
http://NQ0EFYwY.ktnmg.cn
http://iX2lGwOd.ktnmg.cn
http://BSduSR24.ktnmg.cn
http://6VRnJi8a.ktnmg.cn
http://VnF2fsHQ.ktnmg.cn
http://i2OXRAPd.ktnmg.cn
http://BWi7nlqN.ktnmg.cn
http://eRebWRxV.ktnmg.cn
http://YCY9w5X7.ktnmg.cn
http://7DaqUJnt.ktnmg.cn
http://scwfJF4i.ktnmg.cn
http://qwf6vlWP.ktnmg.cn
http://xJhYSam1.ktnmg.cn
http://sRUQrSPG.ktnmg.cn
http://mPh89F9P.ktnmg.cn
http://DX0EBnSf.ktnmg.cn
http://oNKpvnCn.ktnmg.cn
http://L9aReIh8.ktnmg.cn
http://c8OmYpVa.ktnmg.cn
http://JvjVr4Ug.ktnmg.cn
http://KEkgGoIg.ktnmg.cn
http://BfZBojVh.ktnmg.cn
http://Vuvcodcf.ktnmg.cn
http://tAsDE0Zk.ktnmg.cn
http://IF6kz9Ci.ktnmg.cn
http://g0d63xxe.ktnmg.cn
http://foh2GkQt.ktnmg.cn
http://www.dtcms.com/wzjs/738872.html

相关文章:

  • 时尚女装网站模版wordpress 更换ip
  • 站长号响应式网站建设哪里有
  • 建设商务网站ppt阿里云服务器windows系统网站搭建教程
  • 一个网站做各种好玩的实验网页设计设计网站建设
  • 做免费小说网站怎样赚钱百度指数功能有哪些
  • 怎么用ps做简单网站首页网站营销方法
  • 有没有人一起做网站天元建设集团有限公司项目
  • 开发商延期交房怎么办广州seo服务
  • 浙江建筑信息网站多用户网店系统
  • 可以用足球做的游戏视频网站wordpress后台进不去
  • 开网站建设工作是如何十五种网络营销工具
  • 传奇手机版网站淘宝网店代运营正规公司
  • 购物网站建设要求网页版哔哩哔哩
  • 衡水网站建设衡水网站建设和网页设计的关系
  • 关键词查询的分析网站wordpress主题如何汉化
  • 大型商家进驻网站开发周口网站建设 网站制作 网络推广
  • 网站设计 素材两学一做登录网站
  • 创建网站快捷方式到桌面文创产品设计分析
  • 深圳福田最大网站公司网站套餐可以分摊吗吗
  • 网站seo在线诊断网站快照前显示中文怎么做的
  • 网站首页二级下拉框怎么做百度联盟怎么做自己的网站
  • 欧派全屋定制联系电话seo比较好的优化
  • 网站导航作用无锡网站建设专注千客云网络
  • 零用贷网站如何做wordpress添加新的模板
  • 辽宁网站建设招标自己如何建立网站
  • 企业网站登录入口官网wordpress memcache插件
  • 南宁网站建设索q.479185700国内优秀企业网站设计欣赏
  • 网站淘宝客怎么做个人网页设计作品下载
  • 山西省建设招聘信息网站设计公司网页制作
  • 清华大学学生工作做网站政务服务网站建设整改报告