通过人人开源生成代码

参考:https://gitee.com/renrenio

后台管理系统:https://gitee.com/renrenio/renren-fast
后台管理前端:https://gitee.com/renrenio/renren-fast-vue
代码生成器:https://gitee.com/renrenio/renren-generator

创建common模块存放公共类

代码参考:https://github.com/zsy0216/guli-mall
此处依赖有调整
image.png

common pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>guli-mall</artifactId>
  7. <groupId>com.zsy</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11. <artifactId>mall-common</artifactId>
  12. <dependencies>
  13. <dependency>
  14. <groupId>com.baomidou</groupId>
  15. <artifactId>mybatis-plus-boot-starter</artifactId>
  16. </dependency>
  17. <dependency>
  18. <groupId>mysql</groupId>
  19. <artifactId>mysql-connector-java</artifactId>
  20. </dependency>
  21. <dependency>
  22. <groupId>org.apache.httpcomponents</groupId>
  23. <artifactId>httpcore</artifactId>
  24. </dependency>
  25. <dependency>
  26. <groupId>commons-lang</groupId>
  27. <artifactId>commons-lang</artifactId>
  28. </dependency>
  29. <dependency>
  30. <groupId>org.projectlombok</groupId>
  31. <artifactId>lombok</artifactId>
  32. </dependency>
  33. <!-- <dependency>-->
  34. <!-- <groupId>org.hibernate</groupId>-->
  35. <!-- <artifactId>hibernate-validator</artifactId>-->
  36. <!-- <version>5.0.2.Final</version>-->
  37. <!-- </dependency>-->
  38. <dependency>
  39. <groupId>org.springframework.boot</groupId>
  40. <artifactId>spring-boot-starter-web</artifactId>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.springframework.cloud</groupId>
  44. <artifactId>spring-cloud-starter-openfeign</artifactId>
  45. <exclusions>
  46. <exclusion>
  47. <groupId>com.google.code.findbugs</groupId>
  48. <artifactId>jsr305</artifactId>
  49. </exclusion>
  50. </exclusions>
  51. </dependency>
  52. <dependency>
  53. <groupId>org.springframework.boot</groupId>
  54. <artifactId>spring-boot-starter-test</artifactId>
  55. <scope>test</scope>
  56. </dependency>
  57. <dependency>
  58. <groupId>javax.validation</groupId>
  59. <artifactId>validation-api</artifactId>
  60. <version>2.0.1.Final</version>
  61. </dependency>
  62. </dependencies>
  63. </project>

父模块 pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>com.zsy</groupId>
  6. <artifactId>guli-mall</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <packaging>pom</packaging>
  9. <modules>
  10. <module>mall-coupon</module>
  11. <module>mall-member</module>
  12. <module>mall-order</module>
  13. <module>mall-product</module>
  14. <module>mall-ware</module>
  15. <module>mall-common</module>
  16. </modules>
  17. <name>guli-mall</name>
  18. <description>parent</description>
  19. <!-- 这里的属性会被子模块继承 -->
  20. <properties>
  21. <java.version>1.8</java.version>
  22. <mall.version>0.0.1-SNAPSHOT</mall.version>
  23. <maven.compiler.source>8</maven.compiler.source>
  24. <maven.compiler.target>8</maven.compiler.target>
  25. <lombok.version>1.18.18</lombok.version>
  26. <mybatis-plus.version>3.4.2</mybatis-plus.version>
  27. <mysql.version>8.0.23</mysql.version>
  28. <http.components.version>4.4.13</http.components.version>
  29. <commons.lang.version>2.6</commons.lang.version>
  30. <spring.boot.version>2.4.3</spring.boot.version>
  31. <spring-cloud.version>2020.0.1</spring-cloud.version>
  32. </properties>
  33. <!-- 子模块继承父模块之后,提供作用:锁定版本 + 子模块不用再写 version -->
  34. <dependencyManagement>
  35. <dependencies>
  36. <dependency>
  37. <groupId>org.springframework.boot</groupId>
  38. <artifactId>spring-boot-dependencies</artifactId>
  39. <version>${spring.boot.version}</version>
  40. <type>pom</type>
  41. <scope>import</scope>
  42. </dependency>
  43. <dependency>
  44. <groupId>org.springframework.cloud</groupId>
  45. <artifactId>spring-cloud-dependencies</artifactId>
  46. <version>${spring-cloud.version}</version>
  47. <type>pom</type>
  48. <scope>import</scope>
  49. </dependency>
  50. <dependency>
  51. <groupId>com.baomidou</groupId>
  52. <artifactId>mybatis-plus-boot-starter</artifactId>
  53. <version>${mybatis-plus.version}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>mysql</groupId>
  57. <artifactId>mysql-connector-java</artifactId>
  58. <version>${mysql.version}</version>
  59. </dependency>
  60. <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
  61. <dependency>
  62. <groupId>org.apache.httpcomponents</groupId>
  63. <artifactId>httpcore</artifactId>
  64. <version>${http.components.version}</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>commons-lang</groupId>
  68. <artifactId>commons-lang</artifactId>
  69. <version>${commons.lang.version}</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.projectlombok</groupId>
  73. <artifactId>lombok</artifactId>
  74. <version>${lombok.version}</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>com.zsy</groupId>
  78. <artifactId>mall-common</artifactId>
  79. <version>${mall.version}</version>
  80. </dependency>
  81. </dependencies>
  82. </dependencyManagement>
  83. <!-- 这里的依赖会被子模块继承 -->
  84. <dependencies>
  85. <dependency>
  86. <groupId>org.springframework.boot</groupId>
  87. <artifactId>spring-boot-starter-test</artifactId>
  88. <scope>test</scope>
  89. </dependency>
  90. </dependencies>
  91. </project>

商品模块pom.xml

其他服务类似

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>com.zsy</groupId>
  7. <artifactId>guli-mall</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <groupId>com.zsy</groupId>
  11. <artifactId>mall-product</artifactId>
  12. <version>0.0.1-SNAPSHOT</version>
  13. <name>mall-product</name>
  14. <description>商品服务</description>
  15. <dependencies>
  16. <dependency>
  17. <groupId>com.zsy</groupId>
  18. <artifactId>mall-common</artifactId>
  19. </dependency>
  20. </dependencies>
  21. <build>
  22. <plugins>
  23. <plugin>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-maven-plugin</artifactId>
  26. </plugin>
  27. </plugins>
  28. </build>
  29. </project>