尚医通 (二)项目搭建

末蓝、 2024-03-30 03:20 162阅读 0赞

目录

  • 一、工程结构介绍
    • 1、工程结构
    • 2、模块说明
  • 二、创建父工程
    • 1、创建sprigboot工程yygh_parent
    • 2、删除 src 目录
    • 3、配置 pom.xml
    • 4、在pom.xml中添加依赖的版本
  • 三、搭建model模块
    • 1、在父工程yygh_parent下面创建模块model
    • 2、添加项目需要的依赖
    • 3、复制项目实体类和VO类
  • 四、搭建service模块
    • 1、在父工程yygh_parent下面创建模块service
    • 2、添加模块类型是pom
    • 3、添加项目需要的依赖
  • 五、搭建医院模块service_hosp模块
    • 1、在父工程service模块下面创建子模块service_hosp
  • 六、mbg模块

一、工程结构介绍

1、工程结构

在这里插入图片描述

2、模块说明

在这里插入图片描述

二、创建父工程

1、创建sprigboot工程yygh_parent

在idea开发工具中,使用 Spring Initializr 快速初始化一个 Spring Boot 模块,版本使用:2.2.1.RELEASE

2、删除 src 目录

https://donglin.blog.csdn.net/article/details/128483767

3、配置 pom.xml

修改版本为 :2.2.1.RELEASE
在这里插入图片描述
< artifactId > 节点后面添加 pom类型

  1. <artifactId>guli-parent</artifactId>
  2. <packaging>pom</packaging>

4、在pom.xml中添加依赖的版本

删除pom.xml中的< dependencies >内容

  1. <!-- 以下内容删除 -->
  2. <dependencies>
  3. <dependency>
  4. <groupId>org.springframework.boot</groupId>
  5. <artifactId>spring-boot-starter</artifactId>
  6. </dependency>
  7. <dependency>
  8. <groupId>org.springframework.boot</groupId>
  9. <artifactId>spring-boot-starter-test</artifactId>
  10. <scope>test</scope>
  11. </dependency>
  12. </dependencies>

添加 < properties >确定依赖的版本

  1. <properties>
  2. <java.version>1.8</java.version>
  3. <cloud.version>Hoxton.RELEASE</cloud.version>
  4. <alibaba.version>2.2.0.RELEASE</alibaba.version>
  5. <mybatis-plus.version>3.3.1</mybatis-plus.version>
  6. <mysql.version>5.1.46</mysql.version>
  7. <swagger.version>2.7.0</swagger.version>
  8. <jwt.version>0.7.0</jwt.version>
  9. <fastjson.version>1.2.29</fastjson.version>
  10. <httpclient.version>4.5.1</httpclient.version>
  11. <easyexcel.version>2.2.0-beta2</easyexcel.version>
  12. <aliyun.version>4.1.1</aliyun.version>
  13. <oss.version>3.9.1</oss.version>
  14. <jodatime.version>2.10.1</jodatime.version>
  15. </properties>

配置 < dependencyManagement > 锁定依赖的版本

  1. <!--配置dependencyManagement锁定依赖的版本-->
  2. <dependencyManagement>
  3. <dependencies>
  4. <dependency>
  5. <groupId>org.springframework.cloud</groupId>
  6. <artifactId>spring-cloud-dependencies</artifactId>
  7. <version>${
  8. cloud.version}</version>
  9. <type>pom</type>
  10. <scope>import</scope>
  11. </dependency>
  12. <dependency>
  13. <groupId>com.alibaba.cloud</groupId>
  14. <artifactId>spring-cloud-alibaba-dependencies</artifactId>
  15. <version>${
  16. alibaba.version}</version>
  17. <type>pom</type>
  18. <scope>import</scope>
  19. </dependency>
  20. <!--mybatis-plus 持久层-->
  21. <dependency>
  22. <groupId>com.baomidou</groupId>
  23. <artifactId>mybatis-plus-boot-starter</artifactId>
  24. <version>${
  25. mybatis-plus.version}</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>mysql</groupId>
  29. <artifactId>mysql-connector-java</artifactId>
  30. <version>${
  31. mysql.version}</version>
  32. </dependency>
  33. <!--swagger-->
  34. <dependency>
  35. <groupId>io.springfox</groupId>
  36. <artifactId>springfox-swagger2</artifactId>
  37. <version>${
  38. swagger.version}</version>
  39. </dependency>
  40. <!--swagger ui-->
  41. <dependency>
  42. <groupId>io.springfox</groupId>
  43. <artifactId>springfox-swagger-ui</artifactId>
  44. <version>${
  45. swagger.version}</version>
  46. </dependency>
  47. <dependency>
  48. <groupId>io.jsonwebtoken</groupId>
  49. <artifactId>jjwt</artifactId>
  50. <version>${
  51. jwt.version}</version>
  52. </dependency>
  53. <dependency>
  54. <groupId>org.apache.httpcomponents</groupId>
  55. <artifactId>httpclient</artifactId>
  56. <version>${
  57. httpclient.version}</version>
  58. </dependency>
  59. <dependency>
  60. <groupId>com.alibaba</groupId>
  61. <artifactId>fastjson</artifactId>
  62. <version>${
  63. fastjson.version}</version>
  64. </dependency>
  65. <dependency>
  66. <groupId>com.alibaba</groupId>
  67. <artifactId>easyexcel</artifactId>
  68. <version>${
  69. easyexcel.version}</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>com.aliyun</groupId>
  73. <artifactId>aliyun-java-sdk-core</artifactId>
  74. <version>${
  75. aliyun.version}</version>
  76. </dependency>
  77. <dependency>
  78. <groupId>com.aliyun.oss</groupId>
  79. <artifactId>aliyun-sdk-oss</artifactId>
  80. <version>${
  81. oss.version}</version>
  82. </dependency>
  83. <!--日期时间工具-->
  84. <dependency>
  85. <groupId>joda-time</groupId>
  86. <artifactId>joda-time</artifactId>
  87. <version>${
  88. jodatime.version}</version>
  89. </dependency>
  90. </dependencies>
  91. </dependencyManagement>

依赖爆红解决方案
https://donglin.blog.csdn.net/article/details/125453450
注意:父工程搭建好了,一定要将pom.xml文件中的如下插件删掉,否则后续再对父工程安装的时候会报错。

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.springframework.boot</groupId>
  5. <artifactId>spring-boot-maven-plugin</artifactId>
  6. </plugin>
  7. </plugins>
  8. </build>

三、搭建model模块

1、在父工程yygh_parent下面创建模块model

2、添加项目需要的依赖

  1. <dependencies>
  2. <dependency>
  3. <groupId>org.projectlombok</groupId>
  4. <artifactId>lombok</artifactId>
  5. </dependency>
  6. <!--mybatis-plus-->
  7. <dependency>
  8. <groupId>com.baomidou</groupId>
  9. <artifactId>mybatis-plus-boot-starter</artifactId>
  10. <scope>provided </scope>
  11. </dependency>
  12. <!--swagger-->
  13. <dependency>
  14. <groupId>io.springfox</groupId>
  15. <artifactId>springfox-swagger2</artifactId>
  16. <scope>provided </scope>
  17. </dependency>
  18. <dependency>
  19. <groupId>com.alibaba</groupId>
  20. <artifactId>easyexcel</artifactId>
  21. <scope>provided </scope>
  22. </dependency>
  23. <dependency>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-starter-data-mongodb</artifactId>
  26. <scope>provided </scope>
  27. </dependency>
  28. <dependency>
  29. <groupId>com.alibaba</groupId>
  30. <artifactId>fastjson</artifactId>
  31. <scope>provided </scope>
  32. </dependency>
  33. </dependencies>

3、复制项目实体类和VO类

在这里插入图片描述

四、搭建service模块

1、在父工程yygh_parent下面创建模块service

2、添加模块类型是pom

< artifactId > 节点后面添加 pom类型

  1. <artifactId>service</artifactId>
  2. <packaging>pom</packaging>

3、添加项目需要的依赖

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.atguigu</groupId>
  4. <artifactId>model</artifactId>
  5. <version>0.0.1-SNAPSHOT</version>
  6. </dependency>
  7. <!--web-->
  8. <dependency>
  9. <groupId>org.springframework.boot</groupId>
  10. <artifactId>spring-boot-starter-web</artifactId>
  11. </dependency>
  12. <!--mybatis-plus-->
  13. <dependency>
  14. <groupId>com.baomidou</groupId>
  15. <artifactId>mybatis-plus-boot-starter</artifactId>
  16. </dependency>
  17. <!--mysql-->
  18. <dependency>
  19. <groupId>mysql</groupId>
  20. <artifactId>mysql-connector-java</artifactId>
  21. </dependency>
  22. <!--开发者工具-->
  23. <dependency>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-devtools</artifactId>
  26. <optional>true</optional>
  27. </dependency>
  28. <!-- 服务调用feign -->
  29. <dependency>
  30. <groupId>org.springframework.cloud</groupId>
  31. <artifactId>spring-cloud-starter-openfeign</artifactId>
  32. </dependency>
  33. <!-- 服务注册 -->
  34. <dependency>
  35. <groupId>com.alibaba.cloud</groupId>
  36. <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  37. </dependency>
  38. </dependencies>

注意:在上面这些依赖中,其中最后两个openfeign和nacos依赖暂时用不着,也可以暂时先注释掉,否则启动时报错,但是不影响使用。

五、搭建医院模块service_hosp模块

1、在父工程service模块下面创建子模块service_hosp

六、mbg模块

https://donglin.blog.csdn.net/article/details/128486154
在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,162人围观)

还没有评论,来说两句吧...

相关阅读