前后端交互概念

server/2024/11/15 4:35:29/

前后端交互概念

  • 1前后端分离开发概念
  • 2搭建后端环境
    • 2.1配置文件
    • commom
    • common-util
    • service-util
    • model
    • service
  • gitee使用

1前后端分离开发概念

前段:运用html、css、js和现成库,对数据作展示。
后端:运用Java和Java框架,提供数据或操作。
前段通过ajax 调用后端,后端通过json 提供数据逻辑操作
后端的开发接口:controller、service、mapper
在这里插入图片描述

2搭建后端环境

在这里插入图片描述
项目模块构建
hospital-manage:医院接口模拟端(已开发,直接使用)
yygh-parent:根目录,管理子模块:
-common:公共模块父节点
-common-util:工具类模块,所有模块都可以依赖于它
rabbit-util:rabbitmq业务封装
-service-util:service服务的工具包,包含service服务的公共配置类,所有 service模块依赖于它
server-gateway:服务网关
-model:实体类模块
-service:api接口服务父节点
service-hosp:医院api接口服务
service-cmn:公共api接口服务
service-user:用户api接口服务
service-order:订单api接口服务
service-oss:文件api接口服务
service-sms:短信 api接口服务
service-task:定时任务服务
service-statistics:统计api接口服务
service-client:feign服务调用父节点
service-cmn-client:公共api接口
service-hosp-client:医院api接口
service-order-client:订单api接口
service-user:用户api接口

在这里插入图片描述

2.1配置文件

javascript"><?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.2.1.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.atguigu</groupId><artifactId>yygh_parent</artifactId><packaging>pom</packaging><version>0.0.1-SNAPSHOT</version><name>yygh_parent</name><description>Demo project for Spring Boot</description><properties><java.version>1.8</java.version><cloud.version>Hoxton.RELEASE</cloud.version><alibaba.version>2.2.0.RELEASE</alibaba.version><mybatis-plus.version>3.3.1</mybatis-plus.version><mysql.version>5.1.46</mysql.version><swagger.version>2.7.0</swagger.version><jwt.version>0.7.0</jwt.version><fastjson.version>1.2.29</fastjson.version><httpclient.version>4.5.1</httpclient.version><easyexcel.version>2.2.0-beta2</easyexcel.version><aliyun.version>4.1.1</aliyun.version><oss.version>3.9.1</oss.version><jodatime.version>2.10.1</jodatime.version></properties><!--配置dependencyManagement锁定依赖的版本--><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${cloud.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${alibaba.version}</version><type>pom</type><scope>import</scope></dependency><!--mybatis-plus 持久层--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>${mybatis-plus.version}</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.version}</version></dependency><!--swagger--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>${swagger.version}</version></dependency><!--swagger ui--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>${swagger.version}</version></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId><version>${jwt.version}</version></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>${httpclient.version}</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>${fastjson.version}</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>${easyexcel.version}</version></dependency><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>${aliyun.version}</version></dependency><dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>${oss.version}</version></dependency><!--日期时间工具--><dependency><groupId>joda-time</groupId><artifactId>joda-time</artifactId><version>${jodatime.version}</version></dependency></dependencies></dependencyManagement></project>

创建一个新的子模块在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

commom

再commom子模块中 再建一个子模块
common:公共模块父节点

javascript"><?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>yygh_parent</artifactId><groupId>com.atguigu</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>common</artifactId><packaging>pom</packaging><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><scope>provided </scope></dependency><!--mybatis-plus--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><scope>provided </scope></dependency><!--lombok用来简化实体类:需要安装lombok插件--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!--swagger--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId></dependency></dependencies></project>

common-util

common-util:工具类模块,所有模块都可以依赖于它

javascript"><?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>yygh_parent</artifactId><groupId>com.atguigu</groupId><version>0.0.1-SNAPSHOT</version><relativePath>../../pom.xml</relativePath></parent><modelVersion>4.0.0</modelVersion><artifactId>common-util</artifactId><version>1.0</version><dependencies><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId></dependency><!-- 日期工具栏依赖 --><dependency><groupId>joda-time</groupId><artifactId>joda-time</artifactId></dependency></dependencies></project>

service-util

service-util:service服务的工具包,包含service服务的公共配置类,所有service模块依赖于它

javascript"><?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>yygh_parent</artifactId><groupId>com.atguigu</groupId><version>0.0.1-SNAPSHOT</version><relativePath>../../pom.xml</relativePath></parent><modelVersion>4.0.0</modelVersion><artifactId>service-util</artifactId><dependencies><dependency><groupId>com.atguigu</groupId><artifactId>common-util</artifactId><version>1.0</version></dependency><!-- redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- spring2.X集成redis所需common-pool2--><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>2.6.0</version></dependency></dependencies></project>

model

搭建model模块
搭建过程同common-util父模块

javascript"><?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>yygh_parent</artifactId><groupId>com.atguigu</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>model</artifactId><dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!--mybatis-plus--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><scope>provided </scope></dependency><!--swagger--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><scope>provided </scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><scope>provided </scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-mongodb</artifactId><scope>provided </scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><scope>provided </scope></dependency></dependencies></project>

service

搭建service
搭建过程同common父模块

javascript"><?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>yygh_parent</artifactId><groupId>com.atguigu</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>service</artifactId><packaging>pom</packaging><dependencies><dependency><groupId>com.atguigu</groupId><artifactId>service-util</artifactId><version>1.0</version></dependency><dependency><groupId>com.atguigu</groupId><artifactId>model</artifactId><version>1.0</version></dependency><!--web--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!--mybatis-plus--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!--mysql--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!--开发者工具--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional></dependency><!-- 服务调用feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><!-- 服务注册 --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency><!-- 流量控制 --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-sentinel</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes> <include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build></project>

删除这个src
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

gitee使用

在这里插入图片描述

https://gitee.com/gao-pengbo/yygh_parent.git


http://www.ppmy.cn/server/8068.html

相关文章

【java毕业设计】 基于Spring Boot+mysql的课程作业管理系设计与实现(程序源码)-课程作业管理系

基于Spring Bootmysql的课程作业管理系设计与实现&#xff08;程序源码毕业论文&#xff09; 大家好&#xff0c;今天给大家介绍基于Spring Bootmysql的课程作业管理系设计与实现&#xff0c;本论文只截取部分文章重点&#xff0c;文章末尾附有本毕业设计完整源码及论文的获取方…

Basic TCP Server Client

Server #include <stdio.h> #include <string.h> #include <unistd.h> // read and write (TCP); sendto and recvfrom (UDP) #include <arpa/inet.h> // 包含#include <sys/socket.h>int main(int argc, char* argv[]) {// 1. 创建监听fdint f…

AI安全之问:我们的智能助手真的安全吗?

在我们日益依赖人工智能来撰写文档、编写程序代码、甚至创作艺术作品的今天&#xff0c;我们是否曾经想过这些智能系统可能面临的被恶意操纵的风险&#xff1f; 分享几个网站 GPT-3.5研究测试&#xff1a; https://hujiaoai.cn GPT-4研究测试&#xff1a; https://higpt4.cn…

C++相关概念和易错语法(8)(匿名对象、构造+拷贝构造优化、构造析构顺序)

1.匿名对象 当我们实例化对象后&#xff0c;有的对象可能只使用一次&#xff0c;之后就没用了。这个时候我们往往要主动去析构它&#xff0c;否则会占着浪费空间。但是如果遇到大量的这种情况&#xff0c;我们并不想每次都去创建对象、调用、析构&#xff0c;这样会写出很多重…

数据结构––kmp算法(串)

kmp算法作为串的一个重要内容&#xff0c;必然有一定的难度&#xff0c;而在看到各类教辅书里的概念与解释后&#xff0c;其晦涩难懂的内容直接劝退一部分人&#xff0c;现在&#xff0c;让我们来看看吧 KMP解决的问题类型 KMP算法的作用就是在一个已知的字符串中查找子串的位…

【学习笔记之vue】vue项目放在springboot项目里后,刷新页面会显示whitelabel error page

vue项目放在springboot项目里后&#xff0c;刷新页面会显示whitelabel error page。 解决方案: 当你在Spring Boot项目中嵌入Vue项目&#xff0c;并且刷新页面时遇到了“Whitelabel Error Page”&#xff0c;这通常意味着Spring Boot后端没有正确地处理前端路由的请求。Vue.j…

windows下python opencv ffmpeg读取摄像头实现rtsp推流 拉流

windows下python opencv ffmpeg读取摄像头实现rtsp推流 拉流 整体流程1.下载所需文件1. 1下载rtsp推流服务器1.2 下载ffmpeg2. 开启RTSP服务器3. opencv 读取摄像头并调用ffmpeg进行推流4. opencv进行拉流5. opencv异步拉流整体流程 1.下载所需文件 1. 1下载rtsp推流服务器 下…

SpringMVC--RESTful

1. RESTful 1.1. RESTful简介 REST&#xff1a;Representational State Transfer&#xff0c;表现层资源状态转移。 RESTful是一种网络架构风格&#xff0c;它定义了如何通过网络进行数据的交互。这种风格基于HTTP协议&#xff0c;使得网络应用之间的通信变得更加简洁和高效。…